/* ========== 企业销售管理平台 · 现代管理后台样式 ========== */
:root {
    --accent: #4c6fff;
    --accent-deep: #3b5ae0;
    --accent-soft: rgba(76, 111, 255, .1);
    --bg: #f3f5fa;
    --card: #ffffff;
    --text: #1d2333;
    --text-2: #5b6478;
    --text-3: #9aa3b8;
    --line: #e6e9f2;
    --sidebar-bg: #141a2e;
    --sidebar-text: #8b93ad;
    --sidebar-active: #ffffff;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(20, 26, 46, .05), 0 4px 16px rgba(20, 26, 46, .06);
    --shadow-lg: 0 8px 32px rgba(20, 26, 46, .14);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 15px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
svg { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- 侧边栏 ---------- */
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: 248px;
    background: var(--sidebar-bg);
    display: flex; flex-direction: column;
    z-index: 60; transition: transform .25s ease;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 20px 20px 18px; border-bottom: 1px solid rgba(255,255,255,.06);
}
.brand-logo {
    width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
    background: linear-gradient(135deg, #4c6fff, #7c9aff);
    color: #fff; font-weight: 700; font-size: 17px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(76,111,255,.4);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.brand-text strong { color: #fff; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text span { color: var(--sidebar-text); font-size: 11px; letter-spacing: .04em; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 12px 20px; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 4px; }

.nav-label {
    color: #5b6480; font-size: 11px; letter-spacing: .08em;
    padding: 16px 12px 6px; user-select: none;
}
.nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 12px; margin: 2px 0; border-radius: 9px;
    color: var(--sidebar-text); font-size: 14px; cursor: pointer;
    border: none; background: none; width: 100%; text-align: left;
    transition: background .15s, color .15s;
    font-family: inherit;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #d4d9e8; }
.nav-item.active {
    background: linear-gradient(90deg, var(--accent), #6284ff);
    color: var(--sidebar-active);
    box-shadow: 0 4px 14px rgba(76,111,255,.35);
}
.nav-icon { display: inline-flex; width: 20px; justify-content: center; flex-shrink: 0; }
.nav-arrow { margin-left: auto; transition: transform .2s; width: 14px; height: 14px; }
.nav-group.open .nav-arrow { transform: rotate(90deg); }
.nav-group.open > .nav-group-toggle { color: #d4d9e8; }
.nav-submenu { display: none; padding: 2px 0 4px; }
.nav-group.open .nav-submenu { display: block; }
.nav-subitem {
    display: flex; align-items: center; gap: 11px;
    padding: 8.5px 12px 8.5px 20px; margin: 1px 0; border-radius: 9px;
    color: var(--sidebar-text); font-size: 13.5px;
    transition: background .15s, color .15s;
}
.nav-subitem:hover { background: rgba(255,255,255,.06); color: #d4d9e8; }
.nav-subitem.active { color: #fff; background: rgba(76,111,255,.28); }
.nav-subitem .nav-icon svg { width: 1em; height: 1em; }
.nav-sub-badge {
    margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 9px; background: #ef4444; color: #fff;
    font-size: 11px; line-height: 18px; text-align: center; font-weight: 600;
}

.sidebar-foot {
    padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.06);
    color: #5b6480; font-size: 11.5px;
}
.sidebar-mask {
    display: none; position: fixed; inset: 0;
    background: rgba(15,20,36,.5); z-index: 55; backdrop-filter: blur(2px);
}

/* ---------- 主区域 ---------- */
.main { margin-left: 248px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; gap: 14px;
    padding: 0 28px; height: 62px;
    background: rgba(255,255,255,.85); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.icon-btn {
    display: none; border: none; background: none; cursor: pointer;
    color: var(--text-2); padding: 8px; border-radius: 8px;
}
.icon-btn:hover { background: var(--bg); }
.topbar-title { font-size: 16.5px; font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }

.user-chip {
    position: relative; display: flex; align-items: center; gap: 10px;
    padding: 6px 10px; border-radius: 10px; cursor: pointer;
    transition: background .15s;
}
.user-chip:hover, .user-chip.open { background: var(--bg); }
.user-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, #4c6fff, #8a6dff);
    color: #fff; font-size: 14px; font-weight: 600;
    display: flex; align-items: center; justify-content: center;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-name { font-size: 13.5px; font-weight: 600; }
.user-role { font-size: 11px; }
.user-role.role-admin { color: #e0533d; }
.user-role.role-sales { color: var(--accent); }
.user-role.role-business { color: #0d9d6c; }
.user-role.role-leader { color: #b06ae0; }
.user-chip .chev { width: 14px; height: 14px; color: var(--text-3); }
.user-menu {
    position: absolute; top: calc(100% + 6px); right: 0; min-width: 180px;
    background: #fff; border: 1px solid var(--line); border-radius: 12px;
    box-shadow: var(--shadow-lg); padding: 6px; display: none;
}
.user-chip.open .user-menu { display: block; }
.user-menu-head { padding: 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex; flex-direction: column; }
.user-menu-head span { font-size: 12px; color: var(--text-3); }
.user-menu-item {
    display: flex; align-items: center; gap: 9px;
    padding: 9px 12px; border-radius: 8px; font-size: 13.5px; color: var(--text-2);
}
.user-menu-item:hover { background: var(--bg); }
.user-menu-item.danger { color: #d5483c; }
.user-menu-item.danger:hover { background: #fdf0ef; }

/* ---------- 内容区 ---------- */
.content { padding: 28px; flex: 1; animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h2 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.page-head .desc { color: var(--text-2); font-size: 13.5px; margin-top: 5px; }

.card {
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 22px;
}
.card + .card { margin-top: 18px; }

/* 统计卡 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 20px; box-shadow: var(--shadow);
    display: flex; align-items: center; gap: 15px;
    transition: transform .18s, box-shadow .18s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-icon {
    width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 19px;
}
.stat-icon svg { width: 21px; height: 21px; }
.stat-icon.c1 { background: #eef2ff; color: #4c6fff; }
.stat-icon.c2 { background: #e8f8f1; color: #0d9d6c; }
.stat-icon.c3 { background: #fef4e8; color: #d97b16; }
.stat-icon.c4 { background: #f5ecfd; color: #9b4edd; }
.stat-icon.c5 { background: #fdeeee; color: #d5483c; }
.stat-icon.c6 { background: #e9f6fd; color: #1290c9; }
.stat-info { display: flex; flex-direction: column; }
.stat-num { font-size: 24px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.stat-label { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }

/* 快捷入口 */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.quick-item {
    display: flex; align-items: center; gap: 13px;
    padding: 16px 18px; border: 1px solid var(--line); border-radius: 11px;
    background: #fff; transition: all .16s;
}
.quick-item:hover { border-color: var(--accent); box-shadow: 0 4px 16px rgba(76,111,255,.14); transform: translateY(-1px); }
.quick-item .q-icon {
    width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--accent);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.quick-item .q-icon svg { width: 18px; height: 18px; }
.quick-item strong { font-size: 14px; display: block; }
.quick-item span { font-size: 12px; color: var(--text-3); }
.section-title { font-size: 15px; font-weight: 600; margin: 26px 0 13px; display: flex; align-items: center; gap: 8px; }
.section-title::before { content: ''; width: 4px; height: 15px; border-radius: 3px; background: var(--accent); }

/* 按钮 */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 18px; border-radius: 9px; font-size: 13.5px; font-weight: 500;
    border: 1px solid transparent; cursor: pointer; transition: all .15s;
    font-family: inherit; line-height: 1.4;
}
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-deep); box-shadow: 0 4px 12px rgba(76,111,255,.35); }
.btn-outline { background: #fff; border-color: var(--line); color: var(--text-2); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: #fdf0ef; color: #d5483c; }
.btn-danger:hover { background: #d5483c; color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 12.5px; border-radius: 7px; }

/* 表格 */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow); }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
    text-align: left; padding: 12px 16px; background: #f8f9fd;
    color: var(--text-2); font-weight: 600; font-size: 12.5px;
    border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f8faff; }

/* 徽章 */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 500; }
.badge-blue { background: #eef2ff; color: #4c6fff; }
.badge-green { background: #e8f8f1; color: #0d9d6c; }
.badge-orange { background: #fef4e8; color: #d97b16; }
.badge-red { background: #fdeeee; color: #d5483c; }
.badge-gray { background: #eef0f5; color: #6b7288; }
.badge-purple { background: #f5ecfd; color: #9b4edd; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px 20px; }
.form-item { display: flex; flex-direction: column; gap: 6px; }
.form-item label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.form-item label .req { color: #d5483c; margin-left: 2px; }
.input, select.input, textarea.input {
    padding: 9px 13px; border: 1px solid var(--line); border-radius: 9px;
    font-size: 13.5px; font-family: inherit; background: #fff; color: var(--text);
    transition: border-color .15s, box-shadow .15s; width: 100%;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { resize: vertical; min-height: 76px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }

/* 提示条 */
.flash {
    padding: 12px 18px; border-radius: 10px; margin-bottom: 18px; font-size: 13.5px;
    animation: slideDown .3s ease;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.flash-success { background: #e8f8f1; color: #0a7d55; border: 1px solid #bce8d5; }
.flash-error { background: #fdeeee; color: #b03a30; border: 1px solid #f5cdc9; }

/* 空状态 / 建设中 */
.empty-state { text-align: center; padding: 56px 24px; }
.empty-icon { font-size: 42px; margin-bottom: 14px; }
.empty-state h3 { font-size: 17px; margin-bottom: 8px; }
.empty-state p { color: var(--text-2); font-size: 13.5px; margin-bottom: 18px; }

.module-intro { display: flex; flex-direction: column; gap: 0; }
.module-intro .mi-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.mi-icon {
    width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--accent), #7c9aff);
    color: #fff; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 16px rgba(76,111,255,.3);
}
.mi-icon svg { width: 24px; height: 24px; }
.mi-head h3 { font-size: 18px; }
.mi-head p { color: var(--text-2); font-size: 13px; margin-top: 3px; }
.field-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.field-tag {
    padding: 5px 13px; border-radius: 8px; font-size: 12.5px;
    background: #f3f5fb; color: var(--text-2); border: 1px dashed #d5dae8;
}
.perm-tip {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; color: var(--text-3); margin-left: 10px; font-weight: 400;
}

/* 权限矩阵 */
.perm-table td select { min-width: 110px; }

/* 工具栏 */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar .input { width: auto; }
.spacer { flex: 1; }

/* 分页 */
.pagination { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.pagination a, .pagination span {
    padding: 6px 13px; border-radius: 8px; border: 1px solid var(--line);
    font-size: 13px; background: #fff; color: var(--text-2);
}
.pagination .cur { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination a:hover { border-color: var(--accent); color: var(--accent); }

/* 统计条形图 */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 18px; }
.bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 11px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-label { width: 108px; font-size: 13px; color: var(--text-2); text-align: right; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex: 1; height: 22px; background: #f0f2f8; border-radius: 6px; overflow: hidden; }
.bar-fill {
    height: 100%; border-radius: 6px; min-width: 2px;
    background: linear-gradient(90deg, var(--accent), #7c9aff);
    transition: width .6s ease;
}
.bar-val { width: 108px; font-size: 12.5px; font-weight: 600; flex-shrink: 0; }
@media (max-width: 560px) {
    .bar-label { width: 76px; font-size: 12px; }
    .bar-val { width: 76px; }
    .toolbar .input { width: 100% !important; }
}

/* ---------- 登录页 ---------- */
.login-body {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background:
        radial-gradient(1000px 500px at 85% -10%, rgba(124,154,255,.25), transparent 60%),
        radial-gradient(800px 400px at -10% 110%, rgba(76,111,255,.18), transparent 55%),
        #0f1424;
    padding: 24px;
}
.login-card {
    width: 100%; max-width: 400px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.09);
    border-radius: 18px; padding: 40px 38px;
    backdrop-filter: blur(14px);
    box-shadow: 0 20px 60px rgba(0,0,0,.35);
    animation: fadeIn .4s ease;
}
.login-logo {
    width: 52px; height: 52px; border-radius: 14px; margin-bottom: 20px;
    background: linear-gradient(135deg, #4c6fff, #7c9aff);
    color: #fff; font-size: 22px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 24px rgba(76,111,255,.45);
}
.login-card h1 { color: #fff; font-size: 21px; margin-bottom: 6px; }
.login-card .sub { color: #8b93ad; font-size: 13px; margin-bottom: 28px; }
.login-card .form-item label { color: #aab3cc; }
.login-card .input {
    background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.12);
    color: #fff; padding: 11px 14px;
}
.login-card .input::placeholder { color: #5b6480; }
.login-card .input:focus { border-color: var(--accent); background: rgba(255,255,255,.09); }
.login-card .btn-primary { width: 100%; padding: 12px; margin-top: 24px; font-size: 14.5px; border-radius: 10px; }
.login-error {
    background: rgba(213,72,60,.15); border: 1px solid rgba(213,72,60,.35);
    color: #ff9d94; padding: 10px 14px; border-radius: 9px;
    font-size: 13px; margin-bottom: 18px;
}
.login-tip { margin-top: 20px; text-align: center; color: #5b6480; font-size: 12px; }

/* ---------- 响应式 ---------- */
@media (max-width: 960px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
    .sidebar-mask.show { display: block; }
    .main { margin-left: 0; }
    .icon-btn { display: inline-flex; }
    .content { padding: 18px; }
    .user-meta { display: none; }
}

/* ---------- V2：页面头操作区 ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- V2：主从单据明细表 ---------- */
.items-table td { padding: 6px 8px; vertical-align: middle; }
.items-table .item-input { padding: 7px 9px; font-size: 13px; width: 100%; min-width: 60px; }
.items-table select.item-input { min-width: 110px; }
.items-table .calc-field { background: var(--bg); color: var(--text-2); cursor: default; }
.items-table .auto-field { color: var(--text-3); }
.items-table tfoot td { border-top: 2px solid var(--line); padding: 10px 8px; }
.items-total { white-space: nowrap; font-size: 15px; }
.item-del { padding: 3px 9px; line-height: 1.2; font-size: 15px; }

/* ---------- V2：单据详情 ---------- */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px 22px; }
.detail-item { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.d-label { font-size: 12px; color: var(--text-3); }
.d-value { font-size: 14px; font-weight: 500; word-break: break-all; }
.rel-block { margin-top: 18px; }
.deal-stats .stat-card { padding: 16px 18px; }

/* ---------- V3：客户级别星级 ---------- */
.star-rate { display: inline-flex; align-items: center; gap: 1px; white-space: nowrap; }
.star-rate .star {
    width: 18px; height: 18px; fill: #d7dbe6; cursor: default;
    transition: fill .12s, transform .12s;
}
.star-rate.is-editable .star { cursor: pointer; }
.star-rate.is-editable .star:hover { transform: scale(1.25); }
.star-rate .star.on { fill: #f5a623; }
.star-rate .star-val { font-size: 12px; color: var(--text-3); margin-left: 4px; }
.badge-vip {
    background: linear-gradient(135deg, #fff3e0, #ffe3c2);
    color: #c46a00; border: 1px solid #f6c88a;
    font-weight: 600; margin-left: 5px;
}
td .col-actions { white-space: nowrap; }

/* ---------- V3：客户详情页 ---------- */
.company-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.company-head h2 { display: flex; align-items: center; gap: 10px; margin: 0; }
.company-tabs { display: flex; gap: 8px; }
.perf-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 16px 0 4px; }
.perf-card {
    border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px;
    background: var(--card); position: relative; overflow: hidden;
}
.perf-card .perf-label { font-size: 12.5px; color: var(--text-3); }
.perf-card .perf-num { font-size: 24px; font-weight: 700; margin-top: 6px; color: var(--text); }
.perf-card .perf-unit { font-size: 13px; font-weight: 400; color: var(--text-3); margin-left: 3px; }
.perf-card.is-current { border-color: #b9c6ff; background: linear-gradient(135deg, #f4f6ff, #fff); }
.perf-card.is-target { border-color: #b7e6cf; background: linear-gradient(135deg, #f0fbf5, #fff); }
.perf-card .perf-trend { font-size: 12px; margin-top: 6px; color: var(--text-3); }
.perf-card .perf-trend.up { color: #0d9d6c; }
.perf-card .perf-trend.down { color: #d5483c; }
.profile-section-title { font-size: 15px; font-weight: 600; margin: 22px 0 12px; padding-left: 10px; border-left: 3px solid var(--accent); }
.profile-view .pv-item { margin-bottom: 14px; }
.profile-view .pv-label { font-size: 12.5px; color: var(--text-3); margin-bottom: 4px; }
.profile-view .pv-text { font-size: 14px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; color: var(--text); }
.form-grid .form-item.wide { grid-column: 1 / -1; }
.amount-input-wrap { position: relative; }
.amount-input-wrap .unit-suffix { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 12.5px; color: var(--text-3); pointer-events: none; }
.amount-input-wrap .input { padding-right: 42px; }
@media (max-width: 720px) { .perf-grid { grid-template-columns: 1fr; } }

/* ---------- V3：客户思维导图（SVG 径向布局） ---------- */
#cp-mindmap-wrap {
    width: 100%;
    height: calc(100vh - 210px);
    min-height: 420px;
    background:
        radial-gradient(circle at 50% 50%, #fafbff 0%, #f3f5fa 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    user-select: none;
}
#mm-svg { width: 100%; height: 100%; cursor: grab; display: block; }
#mm-svg:active { cursor: grabbing; }
.cp-edge-line { pointer-events: none; }
.cp-node { cursor: pointer; }
.cp-node.cp-center { cursor: default; }
.cp-resize-handle { cursor: nwse-resize; }
.mm-toolbar {
    position: absolute; bottom: 16px; right: 16px;
    display: flex; gap: 6px; z-index: 10;
}
.mm-toolbar button {
    background: var(--card); border: 1px solid var(--line); color: var(--text);
    border-radius: 8px; width: 34px; height: 34px; cursor: pointer;
    font-size: 15px; line-height: 1; box-shadow: var(--shadow);
    transition: border-color .15s, color .15s;
}
.mm-toolbar button:hover { border-color: var(--accent); color: var(--accent); }
.mm-hint {
    position: absolute; left: 14px; bottom: 18px; z-index: 5;
    font-size: 12px; color: var(--text-3);
    background: rgba(255,255,255,.8); padding: 4px 10px; border-radius: 20px;
    border: 1px solid var(--line);
}

/* 右键菜单 */
#cp-ctx-menu {
    position: fixed; background: var(--card); border: 1px solid var(--line);
    border-radius: 10px; box-shadow: var(--shadow-lg); z-index: 9999;
    min-width: 152px; display: none; overflow: hidden; padding: 4px 0;
}
.ctx-item {
    padding: 9px 16px; font-size: 13px; cursor: pointer; color: var(--text);
    white-space: nowrap; transition: background .15s;
}
.ctx-item:hover { background: var(--accent-soft); color: var(--accent); }
.ctx-item.ctx-danger { color: #d5483c; }
.ctx-item.ctx-danger:hover { background: #fdeeee; color: #d5483c; }

/* 节点编辑弹窗 */
.cp-node-modal {
    position: fixed; inset: 0; z-index: 10000;
    display: none; align-items: center; justify-content: center;
}
.cp-node-modal.show { display: flex; }
.cp-node-modal-overlay { position: absolute; inset: 0; background: rgba(15,23,42,.55); }
.cp-node-modal-body {
    position: relative; background: var(--card); border-radius: 14px;
    padding: 24px; width: 460px; max-width: 92vw; z-index: 1;
    box-shadow: var(--shadow-lg);
}
.cp-node-modal-body h3 { margin: 0 0 16px; font-size: 16px; color: var(--text); }
.cp-node-modal-body label { font-size: 12.5px; color: var(--text-3); display: block; margin-bottom: 4px; }
.cp-node-modal-body input[type=text],
.cp-node-modal-body textarea {
    width: 100%; box-sizing: border-box; background: #fff;
    border: 1px solid var(--line); border-radius: 9px; color: var(--text);
    font-size: 14px; padding: 9px 11px; margin-bottom: 12px; resize: vertical;
    font-family: inherit;
}
.cp-node-modal-body input[type=text]:focus,
.cp-node-modal-body textarea:focus { outline: none; border-color: var(--accent); }
.cp-node-modal-body .color-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.cp-node-modal-body .color-swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.cp-node-modal-body .swatch {
    width: 22px; height: 22px; border-radius: 50%; cursor: pointer;
    border: 2px solid transparent; transition: transform .1s;
}
.cp-node-modal-body .swatch:hover { transform: scale(1.18); }
.cp-node-modal-body .swatch.active { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
.cp-node-modal-footer { display: flex; gap: 8px; justify-content: space-between; align-items: center; }
.cp-node-modal-footer .right { display: flex; gap: 8px; }

/* 轻提示 */
.mm-toast {
    position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 14px);
    background: rgba(29,35,51,.92); color: #fff; font-size: 13px;
    padding: 9px 18px; border-radius: 22px; z-index: 10001;
    opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none;
}
.mm-toast.show { opacity: 1; transform: translate(-50%, 0); }
.mm-toast.error { background: rgba(213,72,60,.94); }

/* ========== 面价成本管理：分类树 + 产品列表 ========== */
.pm-layout {
    display: grid; grid-template-columns: 252px 1fr; gap: 18px; align-items: start;
}
.pm-tree-panel { padding: 0; overflow: hidden; position: sticky; top: 90px; }
.pm-tree-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 14px;
}
.pm-tree-body { max-height: calc(100vh - 250px); overflow: auto; padding: 8px; }
.pm-tree-body::-webkit-scrollbar { width: 4px; }
.pm-tree-body::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.pm-tree-foot {
    padding: 8px 14px; font-size: 11.5px; color: var(--text-3);
    border-top: 1px solid var(--line);
}
.pm-tree-ul { list-style: none; margin: 0; padding: 0; }
.pm-tree-ul .pm-tree-ul, .pm-tree-kids { padding-left: 16px; }
.pm-tree-row {
    display: flex; align-items: center; gap: 4px;
    padding: 5px 8px; border-radius: 8px; cursor: default;
}
.pm-tree-row:hover { background: var(--bg); }
.pm-tree-node.active > .pm-tree-row { background: var(--accent-soft); }
.pm-tree-node.active > .pm-tree-row .pm-tree-link { color: var(--accent); font-weight: 600; }
.pm-caret {
    width: 16px; height: 16px; flex-shrink: 0; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--text-3); transition: transform .18s;
}
.pm-caret svg { width: 12px; height: 12px; }
.pm-caret.is-leaf { cursor: default; }
.pm-tree-node.open > .pm-tree-row .pm-caret { transform: rotate(90deg); }
.pm-tree-link {
    flex: 1; min-width: 0; font-size: 13.5px; color: var(--text-2);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pm-tree-link:hover { color: var(--accent); }
.pm-tree-count {
    font-size: 11px; color: var(--text-3); background: var(--bg);
    border-radius: 8px; padding: 1px 7px; flex-shrink: 0;
}
.pm-tree-node.active > .pm-tree-row .pm-tree-count { background: #fff; color: var(--accent); }
.pm-tree-ops { display: none; gap: 2px; flex-shrink: 0; }
.pm-tree-row:hover .pm-tree-ops { display: inline-flex; }
.pm-op {
    border: none; background: none; cursor: pointer; padding: 2px 4px;
    font-size: 12px; color: var(--text-3); border-radius: 5px; line-height: 1;
}
.pm-op:hover { background: var(--accent-soft); color: var(--accent); }
.pm-op-danger:hover { background: #fdf0ef; color: #d5483c; }
.pm-list-panel { min-width: 0; }
.pm-current-path { font-weight: 600; font-size: 14.5px; color: var(--accent); }

/* 弹窗（通用） */
.pm-modal { position: fixed; inset: 0; z-index: 1000; display: none; align-items: center; justify-content: center; }
.pm-modal.show { display: flex; }
.pm-modal-overlay { position: absolute; inset: 0; background: rgba(15,20,36,.5); backdrop-filter: blur(2px); }
.pm-modal-box {
    position: relative; background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg);
    width: 92%; max-height: 86vh; overflow-y: auto; padding: 22px 24px;
    animation: fadeIn .2s ease;
}
.pm-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.pm-modal-head h3 { font-size: 16px; font-weight: 600; }
.pm-x {
    border: none; background: none; cursor: pointer; font-size: 14px;
    color: var(--text-3); padding: 6px; border-radius: 7px;
}
.pm-x:hover { background: var(--bg); color: var(--text); }
.pm-modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* 属性命名网格 */
.pm-fields-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.pm-fields-item { display: flex; align-items: center; gap: 8px; }
.pm-fields-item span {
    width: 22px; height: 22px; border-radius: 6px; background: var(--bg);
    color: var(--text-3); font-size: 11px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
}

/* 分类属性勾选 */
.pm-cf-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pm-cf-item {
    display: flex; align-items: center; gap: 8px; padding: 9px 12px;
    border: 1px solid var(--line); border-radius: 9px; cursor: pointer;
    font-size: 13.5px; color: var(--text-2); transition: all .15s;
}
.pm-cf-item:hover { border-color: var(--accent); }
.pm-cf-item.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.pm-cf-item input { accent-color: var(--accent); }

@media (max-width: 900px) {
    .pm-layout { grid-template-columns: 1fr; }
    .pm-tree-panel { position: static; }
    .pm-tree-body { max-height: 300px; }
    .pm-fields-grid, .pm-cf-list { grid-template-columns: 1fr; }
}

/* ========== 列表内状态快捷修改 ========== */
.status-quick { display: inline-flex; align-items: center; gap: 3px; }
.status-quick.is-editable { cursor: pointer; user-select: none; }
.status-quick.is-editable .badge { transition: box-shadow .15s, filter .15s; }
.status-quick.is-editable:hover .badge { box-shadow: 0 0 0 2px rgba(76,111,255,.18); filter: brightness(.97); }
.status-quick .sq-caret {
    width: 11px; height: 11px; color: var(--text-3); transition: transform .18s;
}
.status-quick.open .sq-caret { transform: rotate(180deg); }
.status-menu {
    position: fixed; z-index: 1200;
    background: #fff; border: 1px solid var(--line); border-radius: 10px;
    box-shadow: var(--shadow-lg); padding: 5px; min-width: 104px;
    animation: fadeIn .15s ease;
}
.status-menu-item {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    width: 100%; border: none; background: none; cursor: pointer;
    font-family: inherit; font-size: 13px; color: var(--text-2);
    padding: 7px 12px; border-radius: 7px; text-align: left; white-space: nowrap;
}
.status-menu-item:hover { background: var(--accent-soft); color: var(--accent); }
.status-menu-item.cur { color: var(--accent); font-weight: 600; }
.status-menu-item.cur::after { content: '✓'; font-size: 12px; font-weight: 700; }

/* ---- 产品名称自动完成建议层（报价/交易明细） ---- */
.prod-suggest {
    position: fixed; z-index: 1200;
    background: #fff; border: 1px solid var(--line); border-radius: 10px;
    box-shadow: var(--shadow-lg); padding: 5px; max-height: 264px; overflow-y: auto;
    animation: fadeIn .15s ease;
}
.prod-suggest-item {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    cursor: pointer; padding: 7px 12px; border-radius: 7px; font-size: 13px;
}
.prod-suggest-item:hover, .prod-suggest-item.is-active { background: var(--accent-soft); }
.prod-suggest-item .ps-name { color: var(--text-1); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prod-suggest-item .ps-meta { color: var(--text-3); font-size: 12px; white-space: nowrap; flex-shrink: 0; }
.prod-suggest-item:hover .ps-meta, .prod-suggest-item.is-active .ps-meta { color: var(--accent); }

/* ===== 公告栏（卡片） ===== */
.announce-bar { background: linear-gradient(135deg, #eff6ff 0%, #fff7ed 100%); border: 1px solid #dbe7ff; border-radius: 14px; padding: 18px 20px; margin-bottom: 22px; box-shadow: 0 2px 10px rgba(59, 130, 246, .07), 0 1px 3px rgba(0,0,0,.04); }
.announce-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.announce-title-row { display: flex; align-items: center; gap: 8px; }
.announce-icon { font-size: 18px; }
.announce-label { font-size: 16px; font-weight: 700; color: #1e3a8a; letter-spacing: .3px; }
.announce-count { font-size: 11px; color: #fff; background: var(--accent); border-radius: 10px; padding: 1px 8px; font-weight: 500; }

.announce-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-bottom: 14px; }
.announce-card { background: #fff; border: 1px solid #e5e9f2; border-radius: 10px; padding: 12px 14px; position: relative; transition: transform .15s ease, box-shadow .15s ease; }
.announce-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(30, 58, 138, .08); }
.announce-card.top { border-color: #fb923c; background: linear-gradient(135deg, #fffaf0 0%, #fff 60%); }
.announce-card.top::before { content: ''; position: absolute; top: 12px; left: 0; width: 3px; height: calc(100% - 24px); background: linear-gradient(180deg, #f97316, #fbbf24); border-radius: 0 2px 2px 0; }
.ac-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; padding-right: 4px; }
.ac-title { font-size: 14px; color: #1f2937; font-weight: 600; line-height: 1.35; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-content { font-size: 12.5px; color: #4b5563; line-height: 1.55; white-space: pre-wrap; max-height: 4.5em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.ac-foot { margin-top: 10px; padding-top: 8px; border-top: 1px dashed #eef0f6; display: flex; justify-content: space-between; font-size: 11px; color: #9ca3af; }
.ac-author { font-weight: 500; }
.ac-time { font-variant-numeric: tabular-nums; }

.announce-empty { color: #9ca3af; font-size: 13px; padding: 14px; text-align: center; background: #fff; border: 1px dashed #e5e9f2; border-radius: 8px; margin-bottom: 14px; font-style: italic; }

.announce-links { padding-top: 12px; border-top: 1px dashed #c5d0e8; }
.al-label { font-size: 12px; color: #4b5563; font-weight: 600; display: block; margin-bottom: 8px; }
.al-list { display: flex; flex-wrap: wrap; gap: 6px; }
.al-link { font-size: 12px; color: var(--accent); background: #fff; border: 1px solid #c7d2fe; border-radius: 14px; padding: 3px 12px 3px 10px; text-decoration: none; transition: all .15s; display: inline-flex; align-items: center; gap: 2px; }
.al-link:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.al-dot { opacity: .5; margin-right: 2px; }

/* ===== 公告详情弹窗 ===== */
.announce-card { cursor: pointer; }
.announce-modal-overlay {
    position: fixed; inset: 0; background: rgba(15, 23, 42, .55);
    display: flex; align-items: center; justify-content: center;
    z-index: 9990;
}
.announce-modal-overlay[hidden] { display: none !important; }
.announce-modal-overlay.is-open { animation: amFadeIn .18s ease-out; }
@keyframes amFadeIn { from { opacity: 0; } to { opacity: 1; } }
.announce-modal {
    background: #fff; border-radius: 14px; width: min(620px, 92vw); max-height: 82vh;
    display: flex; flex-direction: column; overflow: hidden;
    box-shadow: 0 20px 50px rgba(30, 41, 59, .25);
    animation: amSlideUp .22s cubic-bezier(.16,.84,.44,1);
}
@keyframes amSlideUp { from { transform: translateY(18px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.am-head {
    padding: 16px 20px 12px; border-bottom: 1px solid #eef0f6; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
}
.am-title-row { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.am-title-row h3 { font-size: 16px; font-weight: 700; color: #1f2937; margin: 0; line-height: 1.4; word-break: break-word; }
.am-badge { font-size: 11px; background: linear-gradient(90deg,#f97316,#fbbf24); color: #fff; border-radius: 10px; padding: 2px 8px; flex-shrink: 0; font-weight: 500; }
.announce-close {
    border: none; background: #f1f5f9; color: #64748b; width: 28px; height: 28px; border-radius: 50%;
    font-size: 18px; line-height: 26px; cursor: pointer; transition: all .15s; flex-shrink: 0;
}
.announce-close:hover { background: #fee2e2; color: #dc2626; }
.am-body { padding: 16px 20px; font-size: 13.5px; color: #374151; line-height: 1.75; white-space: pre-wrap; word-break: break-word; overflow-y: auto; flex: 1; }
.am-foot { padding: 10px 20px; border-top: 1px solid #eef0f6; font-size: 11px; color: #9ca3af; display: flex; justify-content: space-between; }
.am-foot span { letter-spacing: .2px; }

/* ===== 商务工作台：业务员数据卡 ===== */
.sales-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.sales-tile {
    display: block; text-decoration: none; color: inherit;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 18px 20px; box-shadow: var(--shadow);
    transition: transform .18s, box-shadow .18s, border-color .18s;
}
.sales-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: #c7d2fe; }
.sales-tile.has-req { border-color: #ddd6fe; }
.sales-tile-name {
    font-size: 18px; font-weight: 700; color: var(--text-1); letter-spacing: -.01em;
    padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sales-tile-line { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--text-2); padding: 4px 0; }
.sales-tile-line b { font-size: 16px; font-weight: 700; color: #7c3aed; font-variant-numeric: tabular-nums; }
.sales-tile-line b.zero { color: #d1d5db; font-weight: 500; font-size: 14px; }

/* ===== 年度 / 月度统计 ===== */
.stat-period { display: flex; align-items: center; gap: 12px; margin: 18px 0 12px; flex-wrap: wrap; }
.stat-period-label { font-size: 13px; color: var(--text-3); }
.stat-period-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.stat-period-tab {
    font-size: 13px; padding: 4px 14px; border-radius: 16px; text-decoration: none;
    color: var(--text-2); background: #fff; border: 1px solid var(--line); transition: all .15s;
}
.stat-period-tab:hover { border-color: #a5b4fc; color: var(--accent); }
.stat-period-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

.month-table td, .month-table th { text-align: right; }
.month-table td:first-child, .month-table th:first-child { text-align: left; }
.month-table tfoot td { background: #f9fafc; border-top: 2px solid var(--line); font-size: 13px; }
.month-table tr.month-empty td { color: #c9ced8; }
.month-table tr.month-empty td:first-child { color: var(--text-3); }
.month-table tr.month-cur td { background: #f5f7ff; }
.month-flag { font-size: 10px; background: var(--accent); color: #fff; border-radius: 8px; padding: 1px 6px; margin-left: 2px; }
.month-bar { height: 6px; background: #eef1f7; border-radius: 3px; overflow: hidden; min-width: 60px; }
.month-bar i { display: block; height: 100%; background: linear-gradient(90deg, #34d399, #0d9d6c); border-radius: 3px; }
.month-note { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 12px; color: var(--text-3); }

/* ===== 商务处理表单：只读摘要 ===== */
.process-summary { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; margin-bottom: 18px; }
.process-summary-row { display: flex; padding: 5px 0; font-size: 13px; }
.process-summary-label { width: 110px; flex-shrink: 0; color: var(--text-3); }
.process-summary-value { color: var(--text-1); flex: 1; }

/* ===== 开票处理：企业开票信息只读面板 ===== */
.process-inv-info { background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 12px 16px; margin-bottom: 18px; }
.process-inv-title { font-size: 13px; font-weight: 600; color: #92400e; margin-bottom: 8px; }
.process-inv-row { display: flex; padding: 4px 0; font-size: 13px; }
.process-inv-label { width: 150px; flex-shrink: 0; color: #a16207; }
.process-inv-value { color: #78350f; flex: 1; word-break: break-all; }
