/**
 * 经营金额管理平台原型样式。
 *
 * 视觉方向（实现说明书 §5.1）：可信、克制、数据密集的经营管理工作台，
 * 不是营销型大屏。经营数据以表格和层级结构为主，卡片只用于关键摘要和状态。
 *
 * 色彩 token 复用 apps/web/src/styles.css，只复用视觉，不复用旧导航或旧文案。
 * Danger / Danger Soft 在生产样式中不存在，取自说明书 §5.2。
 */

:root {
    --canvas: #f4f7f5;
    --ink: #13251f;
    --muted: #66756f;
    --line: #dfe6e2;
    --forest: #0d352a;
    --leaf: #1d7657;
    --mint: #9de3bc;
    --sand: #e9e2c8;
    --success: #168657;
    --success-soft: #e3f5ec;
    --warning: #9c6515;
    --warning-soft: #fff3d7;
    --blue: #2f62a5;
    --blue-soft: #e8f0fb;
    --violet: #6b55a5;
    --violet-soft: #f0ecfa;
    --danger: #b54444;
    --danger-soft: #fbeaea;
    --sand-soft: #f7f3e4;
    --grey-soft: #eef1ef;

    --nav-w: 256px;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow: 0 1px 2px rgba(13, 53, 42, 0.05), 0 8px 24px rgba(13, 53, 42, 0.06);
    --shadow-lift: 0 12px 40px rgba(13, 53, 42, 0.14);

    /* 英文和数字优先 Avenir Next，中文回退 PingFang SC（§5.4） */
    --font: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--canvas);
    color: var(--ink);
    font-family: var(--font);
    font-size: 13px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

button {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    cursor: pointer;
}

/* ── 顶部说明条（§6.2） ─────────────────────────────────────────────────── */

.banner {
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 6px 20px;
    background: #e7edf2;
    border-bottom: 1px solid #d3dee7;
    color: #4a5b6b;
    font-size: 11.5px;
    letter-spacing: 0.02em;
    text-align: center;
}

/* ── 布局 ──────────────────────────────────────────────────────────────── */

.shell {
    display: flex;
    align-items: flex-start;
    min-height: calc(100vh - 29px);
}

.nav {
    position: sticky;
    top: 29px;
    flex: 0 0 var(--nav-w);
    width: var(--nav-w);
    height: calc(100vh - 29px);
    overflow-y: auto;
    padding: 20px 0 28px;
    background: var(--forest);
    color: #cfe3da;
}

.nav__brand {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(157, 227, 188, 0.16);
    margin-bottom: 14px;
}

.nav__brand-name {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #fff;
}

.nav__brand-sub {
    margin-top: 1px;
    font-size: 11.5px;
    color: var(--mint);
    letter-spacing: 0.08em;
}

.nav__group {
    margin-bottom: 6px;
}

.nav__group-title {
    padding: 9px 20px 5px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.16em;
    color: rgba(157, 227, 188, 0.62);
}

.nav__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 7px 20px;
    border: 0;
    border-left: 2px solid transparent;
    background: none;
    color: #cfe3da;
    font-size: 13px;
    text-align: left;
    transition: background 0.12s, color 0.12s;
}

.nav__item:hover {
    background: rgba(157, 227, 188, 0.08);
    color: #fff;
}

.nav__item.is-active {
    border-left-color: var(--mint);
    background: rgba(157, 227, 188, 0.14);
    color: #fff;
    font-weight: 600;
}

.nav__foot {
    margin: 18px 20px 0;
    padding-top: 12px;
    border-top: 1px solid rgba(157, 227, 188, 0.16);
    font-size: 10.5px;
    line-height: 1.6;
    color: rgba(207, 227, 218, 0.55);
}

.main {
    flex: 1 1 auto;
    min-width: 0;
    padding: 20px 24px 96px;
}

/* ── 主工具栏（§6.2） ──────────────────────────────────────────────────── */

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 14px;
    padding: 12px 16px;
    margin-bottom: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.field__label {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--muted);
}

.field select,
.field input[type="text"],
.field input[type="search"] {
    height: 30px;
    padding: 0 26px 0 9px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    color: var(--ink);
    font-family: inherit;
    font-size: 12.5px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2366756f' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 9px center;
}

.field input[type="text"],
.field input[type="search"] {
    background-image: none;
    padding-right: 9px;
}

.field select:focus,
.field input:focus {
    outline: 2px solid var(--mint);
    outline-offset: -1px;
}

.field select option:disabled {
    color: #a8b3ae;
}

.field__note {
    font-size: 10.5px;
    color: var(--muted);
}

.toolbar__spacer {
    flex: 1 1 auto;
}

/* ── 页面标题与状态栏 ──────────────────────────────────────────────────── */

.page-head {
    margin-bottom: 14px;
}

.page-head__title {
    margin: 0;
    font-size: 21px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.page-head__desc {
    margin: 3px 0 0;
    max-width: 76ch;
    color: var(--muted);
    font-size: 12.5px;
}

.page-head__context {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 9px;
}

.statusbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin-bottom: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.statusbar__cell {
    flex: 1 1 150px;
    min-width: 0;
    padding: 10px 14px;
    border-right: 1px solid var(--line);
}

.statusbar__cell:last-child {
    border-right: 0;
}

.statusbar__label {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--muted);
}

.statusbar__value {
    margin-top: 2px;
    font-size: 14px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.statusbar__sub {
    font-size: 11px;
    color: var(--muted);
}

/* ── 面板与网格 ────────────────────────────────────────────────────────── */

.panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    background: #fbfdfc;
}

.panel__title {
    font-size: 13px;
    font-weight: 600;
}

.panel__sub {
    font-size: 11px;
    color: var(--muted);
}

.panel__body {
    padding: 12px 14px;
}

.panel__body--flush {
    padding: 0;
}

.panel__foot {
    padding: 9px 14px;
    border-top: 1px solid var(--line);
    background: #fbfdfc;
    font-size: 11.5px;
    color: var(--muted);
}

.grid {
    display: grid;
    gap: 14px;
    align-items: start;
}

.grid--70-30 {
    grid-template-columns: minmax(0, 7fr) minmax(300px, 3fr);
}

.grid--60-40 {
    grid-template-columns: minmax(0, 6fr) minmax(300px, 4fr);
}

.grid--50-50 {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.grid--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid--4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid--30-40-30 {
    grid-template-columns: minmax(240px, 3fr) minmax(0, 4fr) minmax(260px, 3fr);
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

/* ── 摘要卡（只用于关键摘要和状态，不做整页卡片网格） ──────────────────── */

.summary {
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
}

.summary__label {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
}

.summary__value {
    margin-top: 3px;
    font-size: 24px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.summary__unit {
    margin-left: 4px;
    font-size: 11px;
    font-weight: 500;
    color: var(--muted);
}

.summary__delta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
}

.summary--clickable {
    cursor: pointer;
    transition: border-color 0.12s, box-shadow 0.12s;
}

.summary--clickable:hover {
    border-color: var(--leaf);
    box-shadow: var(--shadow-lift);
}

/* ── 表格 ──────────────────────────────────────────────────────────────── */

.table-wrap {
    overflow-x: auto;
}

table.tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

.tbl th,
.tbl td {
    padding: 7px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.tbl thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #fbfdfc;
    border-bottom: 1px solid var(--line);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--muted);
    white-space: nowrap;
}

.tbl tbody tr:last-child td {
    border-bottom: 0;
}

.tbl tbody tr.is-hoverable:hover {
    background: #f6faf8;
}

.tbl tbody tr.is-selected {
    background: var(--success-soft);
}

.tbl tbody tr.is-total td {
    border-top: 2px solid var(--ink);
    background: #f6faf8;
    font-weight: 600;
}

.tbl tbody tr.is-subtle td {
    color: var(--muted);
    background: #fcfdfd;
}

.tbl tbody tr.is-derived td {
    background: #f4f9f6;
    font-weight: 600;
}

.tbl .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.tbl .num--zero {
    color: var(--muted);
}

/* 树表（§6.3） */

.tree-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    margin-right: 5px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #fff;
    color: var(--muted);
    font-size: 9px;
    line-height: 1;
    vertical-align: middle;
}

.tree-toggle:hover {
    border-color: var(--leaf);
    color: var(--leaf);
}

.tree-toggle--placeholder {
    border-color: transparent;
    background: none;
    cursor: default;
}

.tree-toggle--placeholder:hover {
    border-color: transparent;
    color: var(--muted);
}

.tree-label {
    display: inline-flex;
    align-items: center;
}

/* ── 金额单元格与变化语义（§5.3 / §5.4） ────────────────────────────────── */

.amt {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.amt--zero {
    color: var(--muted);
}

/* 变化方向按指标经济含义判断，不是机械涨绿跌红 */
.delta--good {
    color: var(--success);
}

.delta--bad {
    color: var(--danger);
}

.delta--flat {
    color: var(--muted);
}

.delta__arrow {
    font-size: 9px;
}

.link-num {
    padding: 1px 3px;
    margin: -1px -3px;
    border: 0;
    border-radius: 4px;
    background: none;
    font-variant-numeric: tabular-nums;
    font-size: inherit;
    font-weight: inherit;
    text-decoration: underline;
    text-decoration-color: rgba(29, 118, 87, 0.35);
    text-underline-offset: 2px;
    white-space: nowrap;
}

.link-num:hover {
    background: var(--success-soft);
    text-decoration-color: var(--leaf);
}

.link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--leaf);
    font-size: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.link:hover {
    color: var(--forest);
}

/* ── 标签（§5.3 颜色语义） ──────────────────────────────────────────────── */

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 7px;
    border-radius: 20px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.tag__dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    flex: 0 0 auto;
}

/* 绿：完成、确认或正向经营结果 */
.tag--success {
    background: var(--success-soft);
    color: var(--success);
}

/* 红：发布阻断或负向经营影响 */
.tag--danger {
    background: var(--danger-soft);
    color: var(--danger);
}

/* 黄：待处理、试算或不确定 */
.tag--warning {
    background: var(--warning-soft);
    color: var(--warning);
}

/* 蓝：直接事实、来源证据或实际资金证据 */
.tag--blue {
    background: var(--blue-soft);
    color: var(--blue);
}

/* 紫：分摊或派生结果 */
.tag--violet {
    background: var(--violet-soft);
    color: var(--violet);
}

/* 棕黄：管理调整 */
.tag--sand {
    background: var(--sand-soft);
    color: #7a6420;
}

/* 灰：尚未关联、不可用或停用 */
.tag--grey {
    background: var(--grey-soft);
    color: var(--muted);
}

.tag--leaf {
    background: #e6f4ee;
    color: var(--leaf);
}

.tag--lg {
    padding: 3px 10px;
    font-size: 11.5px;
}

/* ── 筛选条件（可移除） ────────────────────────────────────────────────── */

.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 4px 2px 9px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: #fff;
    font-size: 11.5px;
}

.chip__key {
    color: var(--muted);
}

.chip__val {
    font-weight: 600;
}

.chip__x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--muted);
    font-size: 12px;
    line-height: 1;
}

.chip__x:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

.chip--static {
    padding-right: 9px;
    background: #fbfdfc;
}

/* ── 穿透面包屑 ────────────────────────────────────────────────────────── */

.crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    font-size: 12px;
}

.crumbs__sep {
    color: #b7c2bc;
}

.crumbs__item {
    padding: 1px 6px;
    border: 0;
    border-radius: 5px;
    background: none;
    color: var(--leaf);
    font-size: inherit;
}

.crumbs__item:hover {
    background: var(--success-soft);
}

.crumbs__item.is-current {
    background: var(--grey-soft);
    color: var(--ink);
    font-weight: 600;
    cursor: default;
}

/* ── 按钮 ──────────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 29px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    color: var(--ink);
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
    transition: border-color 0.12s, background 0.12s;
}

.btn:hover:not(:disabled) {
    border-color: var(--leaf);
    background: #f6faf8;
}

.btn--primary {
    border-color: var(--forest);
    background: var(--forest);
    color: #fff;
}

.btn--primary:hover:not(:disabled) {
    border-color: var(--leaf);
    background: var(--leaf);
}

.btn--sm {
    height: 24px;
    padding: 0 8px;
    font-size: 11.5px;
}

.btn:disabled {
    background: var(--grey-soft);
    border-color: var(--line);
    color: #a8b3ae;
    cursor: not-allowed;
}

.btn.is-loading {
    position: relative;
    color: transparent;
}

.btn.is-loading::after {
    content: "";
    position: absolute;
    width: 11px;
    height: 11px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    color: var(--leaf);
    animation: spin 0.6s linear infinite;
}

.btn--primary.is-loading::after {
    color: #fff;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.btn-group {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    overflow: hidden;
}

.btn-group button {
    height: 27px;
    padding: 0 11px;
    border: 0;
    border-right: 1px solid var(--line);
    background: none;
    font-size: 12px;
    white-space: nowrap;
}

.btn-group button:last-child {
    border-right: 0;
}

.btn-group button:hover:not(:disabled) {
    background: #f6faf8;
}

.btn-group button.is-active {
    background: var(--forest);
    color: #fff;
    font-weight: 600;
}

.btn-group button:disabled {
    color: #a8b3ae;
    cursor: not-allowed;
}

/* ── 抽屉（§6.3） ──────────────────────────────────────────────────────── */

.drawer-scrim {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(13, 37, 31, 0.28);
    animation: fade 0.14s ease-out;
}

.drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 61;
    width: min(460px, 92vw);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-left: 1px solid var(--line);
    box-shadow: -18px 0 48px rgba(13, 53, 42, 0.16);
    animation: slide-in 0.16s ease-out;
}

@keyframes slide-in {
    from {
        transform: translateX(14px);
        opacity: 0;
    }
}

@keyframes fade {
    from {
        opacity: 0;
    }
}

.drawer__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}

.drawer__title {
    font-size: 15px;
    font-weight: 600;
}

.drawer__sub {
    margin-top: 2px;
    font-size: 11.5px;
    color: var(--muted);
}

.drawer__body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 14px 16px;
}

.drawer__foot {
    padding: 10px 16px;
    border-top: 1px solid var(--line);
    background: #fbfdfc;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--muted);
    font-size: 14px;
    line-height: 1;
    flex: 0 0 auto;
}

.icon-btn:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* ── 弹窗（§6.3） ──────────────────────────────────────────────────────── */

.modal-scrim {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(13, 37, 31, 0.32);
    animation: fade 0.14s ease-out;
}

.modal {
    width: min(640px, 100%);
    max-height: 84vh;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-lg);
    background: #fff;
    box-shadow: var(--shadow-lift);
    overflow: hidden;
}

.modal__head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}

.modal__title {
    font-size: 15px;
    font-weight: 600;
}

.modal__sub {
    margin-top: 2px;
    font-size: 11.5px;
    color: var(--muted);
}

.modal__body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 14px 18px;
}

.modal__foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 11px 18px;
    border-top: 1px solid var(--line);
    background: #fbfdfc;
}

/* ── Toast（§6.3） ─────────────────────────────────────────────────────── */

.toasts {
    position: fixed;
    right: 20px;
    bottom: 76px;
    z-index: 80;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    max-width: 400px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--leaf);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow-lift);
    font-size: 12.5px;
    animation: toast-in 0.16s ease-out;
}

@keyframes toast-in {
    from {
        transform: translateY(6px);
        opacity: 0;
    }
}

.toast--success {
    border-left-color: var(--success);
}

.toast--warning {
    border-left-color: var(--warning);
}

.toast--info {
    border-left-color: var(--blue);
}

.toast__title {
    font-weight: 600;
}

.toast__body {
    color: var(--muted);
}

/* ── 说明块 ────────────────────────────────────────────────────────────── */

.note {
    padding: 8px 11px;
    border-radius: 7px;
    border-left: 3px solid var(--line);
    background: #fbfdfc;
    font-size: 11.5px;
    line-height: 1.6;
    color: var(--muted);
}

.note--blue {
    border-left-color: var(--blue);
    background: var(--blue-soft);
    color: #2a4d78;
}

.note--violet {
    border-left-color: var(--violet);
    background: var(--violet-soft);
    color: #4d3d7d;
}

.note--warning {
    border-left-color: var(--warning);
    background: var(--warning-soft);
    color: #7a5010;
}

.note--danger {
    border-left-color: var(--danger);
    background: var(--danger-soft);
    color: #8f3535;
}

.note--success {
    border-left-color: var(--success);
    background: var(--success-soft);
    color: #0f5f3e;
}

.note--sand {
    border-left-color: #b39a4a;
    background: var(--sand-soft);
    color: #7a6420;
}

.note__title {
    display: block;
    margin-bottom: 2px;
    font-weight: 700;
    color: inherit;
}

/* 原型补充基线标记（待确认） */
.derived-mark {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 0 5px;
    border: 1px dashed #b39a4a;
    border-radius: 4px;
    background: var(--sand-soft);
    color: #7a6420;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
}

/* ── 无数据 / 尚未关联状态（§6.3：不做无权限状态） ──────────────────────── */

.empty {
    padding: 26px 16px;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    background: #fbfdfc;
    text-align: center;
    color: var(--muted);
    font-size: 12.5px;
}

.empty__title {
    font-weight: 600;
    color: var(--ink);
}

.empty__body {
    margin-top: 3px;
}

.unlinked {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--muted);
    font-style: normal;
}

/* ── 定义列表 ──────────────────────────────────────────────────────────── */

.dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 4px 12px;
    font-size: 12.5px;
}

.dl__k {
    color: var(--muted);
}

.dl__v {
    font-variant-numeric: tabular-nums;
    word-break: break-word;
}

/* ── 进度条 ────────────────────────────────────────────────────────────── */

.meter {
    height: 5px;
    border-radius: 3px;
    background: var(--grey-soft);
    overflow: hidden;
}

.meter__fill {
    height: 100%;
    border-radius: 3px;
    background: var(--leaf);
}

.meter__fill--warning {
    background: var(--warning);
}

.meter__fill--danger {
    background: var(--danger);
}

/* ── 图表（全部手写 SVG，无外部依赖） ──────────────────────────────────── */

.chart {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.chart text {
    font-family: var(--font);
    fill: var(--ink);
}

.chart .axis {
    stroke: var(--line);
    stroke-width: 1;
}

.chart .lbl {
    font-size: 11px;
    fill: var(--muted);
}

.chart .val {
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.chart .bar {
    cursor: pointer;
}

.chart .bar:hover {
    opacity: 0.82;
}

.bar--good {
    fill: var(--success);
}

.bar--bad {
    fill: var(--danger);
}

.bar--neutral {
    fill: var(--blue);
}

.bar--total {
    fill: var(--forest);
}

.bar--track {
    fill: var(--grey-soft);
}

.chart .connector {
    stroke: #b7c2bc;
    stroke-width: 1;
    stroke-dasharray: 2 2;
}

/* ── 浮动变体切换器（§8.1，仅 #trace） ─────────────────────────────────── */

.variant-switch {
    position: fixed;
    left: calc(50% + var(--nav-w) / 2);
    bottom: 18px;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 5px 5px 6px;
    border: 1px solid rgba(157, 227, 188, 0.28);
    border-radius: 30px;
    background: var(--forest);
    box-shadow: var(--shadow-lift);
    transform: translateX(-50%);
}

.variant-switch__arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 50%;
    background: rgba(157, 227, 188, 0.14);
    color: var(--mint);
    font-size: 13px;
    line-height: 1;
}

.variant-switch__arrow:hover {
    background: var(--mint);
    color: var(--forest);
}

.variant-switch__name {
    min-width: 148px;
    padding: 0 8px;
    color: #fff;
    font-size: 12.5px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
}

.variant-switch__badge {
    padding: 2px 8px;
    margin-left: 2px;
    border-radius: 20px;
    background: rgba(157, 227, 188, 0.16);
    color: var(--mint);
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.12em;
    white-space: nowrap;
}

.variant-switch__hint {
    padding-right: 6px;
    color: rgba(157, 227, 188, 0.6);
    font-size: 10px;
    white-space: nowrap;
}

/* ── 追踪器页头 ────────────────────────────────────────────────────────── */

.trace-head {
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.trace-head__top {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 13px 16px;
}

.trace-head__obj {
    font-size: 17px;
    font-weight: 600;
}

.trace-head__attr {
    margin-top: 2px;
    font-size: 11.5px;
    color: var(--muted);
}

.trace-head__amt {
    text-align: right;
}

.trace-head__amt-val {
    font-size: 25px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.trace-head__amt-meta {
    margin-top: 1px;
    font-size: 11px;
    color: var(--muted);
}

.trace-head__coverage {
    display: flex;
    flex-wrap: wrap;
    border-top: 1px solid var(--line);
    background: #fbfdfc;
}

.trace-head__cov {
    flex: 1 1 130px;
    padding: 8px 16px;
    border-right: 1px solid var(--line);
}

.trace-head__cov:last-child {
    border-right: 0;
}

.trace-head__cov-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.trace-head__cov-val {
    margin-top: 1px;
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.trace-head__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 16px;
    border-top: 1px solid var(--line);
}

/* 页签 */

.tabs {
    display: inline-flex;
    gap: 2px;
    padding: 2px;
    border-radius: 8px;
    background: var(--grey-soft);
}

.tabs button {
    height: 26px;
    padding: 0 13px;
    border: 0;
    border-radius: 6px;
    background: none;
    font-size: 12.5px;
}

.tabs button:hover:not(.is-active) {
    background: rgba(255, 255, 255, 0.7);
}

.tabs button.is-active {
    background: #fff;
    box-shadow: 0 1px 2px rgba(13, 53, 42, 0.1);
    font-weight: 600;
}

/* ── Variant A：经营叙事流 ─────────────────────────────────────────────── */

.va-ladder {
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
    margin-bottom: 14px;
}

.va-lanes {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
    gap: 14px;
    align-items: start;
}

.va-lane {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 0;
    border-bottom: 1px solid var(--line);
}

.va-lane:last-child {
    border-bottom: 0;
}

.va-lane__name {
    padding: 12px 10px;
    border-right: 1px solid var(--line);
    background: #fbfdfc;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.va-lane__track {
    padding: 6px 0;
    overflow-x: auto;
}

.va-flow {
    display: flex;
    align-items: center;
    gap: 0;
    min-width: min-content;
    padding: 0 10px;
}

.va-node {
    flex: 0 0 auto;
    min-width: 132px;
    max-width: 172px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    text-align: left;
    transition: border-color 0.12s, box-shadow 0.12s;
}

.va-node:hover {
    border-color: var(--leaf);
    box-shadow: var(--shadow);
}

.va-node.is-active {
    border-color: var(--forest);
    border-width: 2px;
    padding: 6px 9px;
    box-shadow: var(--shadow);
}

.va-node--direct {
    border-left: 3px solid var(--blue);
}

.va-node--rule {
    border-left: 3px solid var(--violet);
}

.va-node--derived {
    border-left: 3px solid var(--leaf);
    background: #f4f9f6;
}

.va-node--unlinked {
    border-style: dashed;
    color: var(--muted);
}

.va-node__name {
    font-size: 11.5px;
    font-weight: 600;
}

.va-node__amt {
    font-size: 14px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.va-node__meta {
    font-size: 10px;
    color: var(--muted);
}

/* 连线：金额和关系写在连线上 */
.va-edge {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 78px;
    padding: 0 3px;
}

.va-edge__label {
    padding: 0 4px;
    font-size: 9.5px;
    color: var(--muted);
    text-align: center;
    line-height: 1.3;
    white-space: nowrap;
}

.va-edge__line {
    display: flex;
    align-items: center;
    width: 100%;
}

.va-edge__line::before {
    content: "";
    flex: 1 1 auto;
    height: 1px;
    background: #c8d2cc;
}

.va-edge__line::after {
    content: "";
    flex: 0 0 auto;
    width: 0;
    height: 0;
    border-top: 3px solid transparent;
    border-bottom: 3px solid transparent;
    border-left: 5px solid #c8d2cc;
}

.va-edge--rule .va-edge__line::before {
    background: var(--violet);
    opacity: 0.5;
}

.va-edge--rule .va-edge__line::after {
    border-left-color: var(--violet);
    opacity: 0.5;
}

.va-detail {
    position: sticky;
    top: 40px;
}

/* 实际资金泳道（独立于经营分解） */
.va-cash-lane {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    border-bottom: 1px solid var(--line);
}

.va-cash-lane:last-child {
    border-bottom: 0;
}

/* ── Variant B：证据工作台 ─────────────────────────────────────────────── */

.vb-formula {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
}

.vb-formula__expr {
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.vb-formula__expr b {
    font-weight: 600;
}

.vb-cols {
    display: grid;
    grid-template-columns: minmax(230px, 1fr) minmax(0, 2fr) minmax(250px, 1.1fr);
    gap: 14px;
    align-items: start;
}

.vb-tree {
    font-size: 12.5px;
}

.vb-tree__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 5px 8px;
    border: 0;
    border-radius: 6px;
    background: none;
    text-align: left;
}

.vb-tree__row:hover {
    background: #f6faf8;
}

.vb-tree__row.is-active {
    background: var(--success-soft);
    font-weight: 600;
}

.vb-tree__bar {
    height: 3px;
    margin: 0 8px 4px 8px;
    border-radius: 2px;
}

.vb-timeline {
    position: relative;
    padding-left: 16px;
}

.vb-timeline::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 5px;
    bottom: 5px;
    width: 1px;
    background: var(--line);
}

.vb-tl-item {
    position: relative;
    padding-bottom: 12px;
}

.vb-tl-item::before {
    content: "";
    position: absolute;
    left: -15px;
    top: 4px;
    width: 7px;
    height: 7px;
    border: 1.5px solid #fff;
    border-radius: 50%;
    background: var(--blue);
}

.vb-tl-item--violet::before {
    background: var(--violet);
}

.vb-tl-item--leaf::before {
    background: var(--leaf);
}

.vb-tl-item--sand::before {
    background: #b39a4a;
}

.vb-tl-item--grey::before {
    background: #b7c2bc;
}

.vb-tl-stage {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.vb-tl-title {
    font-size: 12.5px;
    font-weight: 600;
}

.vb-tl-detail {
    font-size: 11.5px;
    color: var(--muted);
}

/* 匹配矩阵 */
.vb-matrix th.vb-matrix__corner {
    background: #fbfdfc;
}

.vb-matrix td.vb-matrix__cell {
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.vb-matrix .cell-match {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 58px;
    padding: 2px 6px;
    border-radius: 5px;
    font-size: 11.5px;
    font-weight: 600;
}

.cell-match--direct {
    background: var(--blue-soft);
    color: var(--blue);
}

.cell-match--part {
    background: #eef3f9;
    color: #46698f;
    border: 1px dashed #9fb6d0;
}

.cell-match--batch {
    background: #f2f6fa;
    color: #6a839f;
}

.cell-match--none {
    background: var(--grey-soft);
    color: var(--muted);
}

/* ── Variant C：对象关系地图 ───────────────────────────────────────────── */

.vc-cols {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 330px);
    gap: 14px;
    align-items: start;
}

.vc-map {
    overflow-x: auto;
}

.vc-map svg {
    display: block;
    min-width: 900px;
}

.vc-node {
    cursor: pointer;
}

.vc-node rect {
    fill: #fff;
    stroke: var(--line);
    stroke-width: 1;
    rx: 8;
}

.vc-node:hover rect {
    stroke: var(--leaf);
}

.vc-node.is-active rect {
    stroke: var(--forest);
    stroke-width: 2;
}

.vc-node.is-primary rect {
    fill: #f4f9f6;
    stroke: var(--leaf);
}

.vc-node.is-muted rect {
    fill: #fbfcfc;
    stroke-dasharray: 3 3;
}

.vc-node.is-unlinked rect {
    fill: var(--grey-soft);
    stroke: #b7c2bc;
    stroke-dasharray: 3 3;
}

.vc-node.is-cash rect {
    fill: var(--blue-soft);
    stroke: #9fb6d0;
}

.vc-node.is-snapshot rect {
    fill: var(--sand-soft);
    stroke: #cdb877;
}

.vc-node__type {
    font-size: 9px;
    fill: var(--muted);
}

.vc-node__name {
    font-size: 11px;
    font-weight: 600;
    fill: var(--ink);
}

/* 边：实际资金证据用不同颜色，不与规则分摊边混用 */
.vc-edge {
    fill: none;
    stroke-width: 1.4;
}

.vc-edge--direct {
    stroke: var(--blue);
}

.vc-edge--rule {
    stroke: var(--violet);
    stroke-dasharray: 5 3;
}

.vc-edge--cash {
    stroke: var(--success);
    stroke-width: 2;
}

.vc-edge--batchOnly {
    stroke: #9fb6d0;
    stroke-dasharray: 2 3;
}

/* 未关联关系：断开的虚线 */
.vc-edge--unlinked {
    stroke: #b7c2bc;
    stroke-dasharray: 3 5;
    opacity: 0.85;
}

.vc-edge__label {
    font-size: 9.5px;
    fill: var(--muted);
}

.vc-edge__label-bg {
    fill: #fff;
    opacity: 0.92;
}

.vc-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 8px 14px;
    border-top: 1px solid var(--line);
    background: #fbfdfc;
    font-size: 11px;
    color: var(--muted);
}

.vc-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.vc-legend__swatch {
    width: 18px;
    height: 0;
    border-top-width: 2px;
    border-top-style: solid;
}

/* ── 场景切换器 ────────────────────────────────────────────────────────── */

.scenario-switch {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 7px;
    overflow: hidden;
    background: #fff;
}

.scenario-switch button {
    height: 27px;
    padding: 0 11px;
    border: 0;
    border-right: 1px solid var(--line);
    background: none;
    font-size: 12px;
    white-space: nowrap;
}

.scenario-switch button:last-child {
    border-right: 0;
}

.scenario-switch button:hover:not(.is-active) {
    background: #f6faf8;
}

.scenario-switch button.is-active {
    background: var(--leaf);
    color: #fff;
    font-weight: 600;
}

/* ── 工具 ──────────────────────────────────────────────────────────────── */

.muted {
    color: var(--muted);
}

.mono-num {
    font-variant-numeric: tabular-nums;
}

.small {
    font-size: 11.5px;
}

.tiny {
    font-size: 10.5px;
}

.strong {
    font-weight: 600;
}

.nowrap {
    white-space: nowrap;
}

.mt-0 {
    margin-top: 0;
}

.mt-1 {
    margin-top: 6px;
}

.mt-2 {
    margin-top: 12px;
}

.mb-1 {
    margin-bottom: 6px;
}

.mb-2 {
    margin-bottom: 12px;
}

.hidden {
    display: none !important;
}

/* ── 响应式：1280px 不出现整页横向溢出（§5.1） ─────────────────────────── */

@media (max-width: 1360px) {
    .vb-cols {
        grid-template-columns: minmax(200px, 0.9fr) minmax(0, 2fr) minmax(220px, 1fr);
    }

    .main {
        padding: 20px 16px 96px;
    }
}

@media (max-width: 1180px) {
    .grid--70-30,
    .grid--60-40,
    .grid--30-40-30,
    .va-lanes,
    .vc-cols {
        grid-template-columns: minmax(0, 1fr);
    }

    .vb-cols {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .grid--4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1023px) {
    :root {
        --nav-w: 60px;
    }

    .nav__brand-name,
    .nav__brand-sub,
    .nav__group-title,
    .nav__foot {
        display: none;
    }

    .nav__item {
        padding: 7px 8px;
        font-size: 10px;
        justify-content: center;
        text-align: center;
    }

    .grid--3,
    .grid--4,
    .grid--50-50,
    .vb-cols {
        grid-template-columns: minmax(0, 1fr);
    }

    .variant-switch {
        left: 50%;
    }
}
