/* ===== 配电箱回路与容量 · 计算流图 ===== */
.dbc {
    background: #fbfafc;
    border: 1px solid #e6e0ef;
    border-radius: 10px;
    padding: 24px 22px;
    margin-bottom: 26px;
    box-shadow: 0 8px 26px rgba(76, 58, 110, .06);
}

.dbc-flow { display: flex; align-items: stretch; gap: 0; }
.dbc-node {
    flex: 1 1 0; min-width: 0;
    background: #fff; border: 1px solid #e6e0ef; border-radius: 8px;
    padding: 13px 14px 12px; display: flex; flex-direction: column; gap: 5px;
    position: relative;
}
.dbc-node b { font-size: 12.5px; color: #3f3a4f; line-height: 1.3; }
.dbc-node-tag {
    font-size: 9.5px; letter-spacing: .1em; color: #9c93ad;
    text-transform: uppercase;
}
.dbc-node output {
    font-size: 30px; line-height: 1; color: #6d28d9;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-variant-numeric: tabular-nums; font-weight: 700;
}
.dbc-node output.dbc-unit-sm { font-size: 20px; }
.dbc-node > em { font-style: normal; font-size: 10px; color: #9c93ad; margin-top: -2px; }
.dbc-node p { margin: 2px 0 0; font-size: 10.5px; line-height: 1.55; color: #8a8271; }
.dbc-formula {
    font-family: ui-monospace, monospace; font-size: 10.5px; color: #8a8271;
    background: #f5f2fa; border-radius: 4px; padding: 3px 6px; align-self: flex-start;
}
.dbc-meta { font-family: ui-monospace, monospace; }
.dbc-meta span { color: #4c1d95; font-weight: 700; }

.dbc-link { flex: 0 0 34px; display: flex; align-items: center; justify-content: center; position: relative; }
.dbc-link::before {
    content: ''; position: absolute; left: 4px; right: 8px; top: 50%;
    height: 1px; background: #ddd5ea;
}
.dbc-link i {
    width: 0; height: 0; border-left: 6px solid #b3a6c9;
    border-top: 4px solid transparent; border-bottom: 4px solid transparent;
    position: relative; z-index: 1; margin-left: 6px;
}

.dbc-node--out { background: #fffdf6; }
.dbc-badge {
    margin-top: 2px; display: inline-block; align-self: flex-start;
    font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 3px;
    background: #f2f0f6; color: #6b6555; border: 1px solid #e2dded;
}
.dbc-badge.is-ok { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.dbc-badge.is-bad { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.dbc-badge.is-warn { background: #fffbeb; color: #92400e; border-color: #fde68a; }

.dbc-params { margin-top: 20px; border-top: 1px solid #e6e0ef; padding-top: 16px; }
.dbc-params h2 { font-size: 12px; letter-spacing: .08em; color: #6b6555; margin: 0 0 12px; }

.dbc-rows-head, .dbc-row {
    display: grid; grid-template-columns: 1.6fr .8fr 1fr .7fr 28px; gap: 7px; align-items: center;
}
.dbc-rows-head {
    font-size: 10px; color: #8b7fa8; font-weight: 700; letter-spacing: .08em;
    padding: 0 2px 6px;
}
.dbc-row { margin-bottom: 7px; }
.dbc-row input, .dbc-row select {
    font: inherit; font-size: 12.5px; padding: 7px 8px; min-width: 0;
    border: 1px solid #e0dae9; border-radius: 5px; background: #fff; color: #3f3a4f;
    font-variant-numeric: tabular-nums;
}
.dbc-row input:focus, .dbc-row select:focus { outline: 2px solid rgba(124, 58, 237, .18); border-color: #7c3aed; }
.dbc-row input.is-bad { border-color: #dc2626; background: #fef2f2; }
.dbc-del {
    border: none; background: #fdeaea; color: #b91c1c; border-radius: 5px;
    width: 26px; height: 26px; cursor: pointer; font-weight: 800; font-size: 13px;
}
.dbc-del:hover { background: #fbd5d5; }

.dbc-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.dbc-add {
    border: 1px dashed #a78bfa; background: #fff; color: #6d28d9;
    border-radius: 6px; padding: 7px 13px; font-size: 12px; font-weight: 700; cursor: pointer;
}
.dbc-add:hover { background: #f7f4ff; }
.dbc-add--tpl { border-style: solid; border-color: #e2dded; color: #6d28d9; background: #f5f2fa; }
.dbc-cos {
    margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
    font-size: 11px; color: #8a8271;
}
.dbc-cos select {
    font: inherit; font-size: 12px; padding: 6px 8px; border: 1px solid #e0dae9;
    border-radius: 5px; background: #fff; color: #3f3a4f;
}

.dbc-basis { margin-top: 18px; border-top: 1px dashed #e2dded; padding-top: 14px; }
.dbc-basis h2 { font-size: 12px; color: #6b6555; margin: 0 0 8px; letter-spacing: .06em; }
.dbc-basis ul { margin: 0; padding-left: 18px; }
.dbc-basis li { font-size: 11.5px; line-height: 1.8; color: #8a8271; }
.dbc-basis code { background: #f5f2fa; padding: 1px 4px; color: #6d28d9; }

@media (max-width: 980px) {
    .dbc-flow { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
    .dbc-link { display: none; }
}
@media (max-width: 640px) {
    .dbc { padding: 16px 14px; }
    .dbc-flow { grid-template-columns: 1fr; }
    .dbc-rows-head { display: none; }
    .dbc-row { grid-template-columns: 1fr 1fr; }
    .dbc-node output { font-size: 26px; }
    .dbc-cos { margin-left: 0; }
}

/* 深色模式 */
[data-theme="dark"] .dbc { background: #141218; border-color: #2c2833; box-shadow: none; }
[data-theme="dark"] .dbc-node { background: #1a1720; border-color: #2c2833; }
[data-theme="dark"] .dbc-node b { color: #e7e2f0; }
[data-theme="dark"] .dbc-node-tag { color: #8a8271; }
[data-theme="dark"] .dbc-node output { color: #c4b5fd; }
[data-theme="dark"] .dbc-node p, [data-theme="dark"] .dbc-node > em { color: #8a8271; }
[data-theme="dark"] .dbc-meta span { color: #c4b5fd; }
[data-theme="dark"] .dbc-formula { background: #221f29; color: #9c93ad; }
[data-theme="dark"] .dbc-node--out { background: #1c1913; }
[data-theme="dark"] .dbc-badge { background: #221f29; border-color: #2c2833; color: #a8a08d; }
[data-theme="dark"] .dbc-badge.is-ok { background: rgba(4, 120, 87, .2); color: #6ee7b7; border-color: rgba(110, 231, 183, .3); }
[data-theme="dark"] .dbc-badge.is-bad { background: rgba(185, 28, 28, .2); color: #fca5a5; border-color: rgba(252, 165, 165, .3); }
[data-theme="dark"] .dbc-badge.is-warn { background: rgba(217, 119, 6, .18); color: #fcd34d; border-color: rgba(252, 211, 77, .3); }
[data-theme="dark"] .dbc-link::before { background: #3a3444; }
[data-theme="dark"] .dbc-link i { border-left-color: #5c5470; }
[data-theme="dark"] .dbc-params, [data-theme="dark"] .dbc-basis { border-color: #2c2833; }
[data-theme="dark"] .dbc-params h2, [data-theme="dark"] .dbc-basis h2 { color: #a8a08d; }
[data-theme="dark"] .dbc-rows-head { color: #9c93ad; }
[data-theme="dark"] .dbc-row input, [data-theme="dark"] .dbc-row select, [data-theme="dark"] .dbc-cos select {
    background: #1a1720; color: #e7e2f0; border-color: #2c2833;
}
[data-theme="dark"] .dbc-del { background: rgba(220, 38, 38, .22); color: #fca5a5; }
[data-theme="dark"] .dbc-add { background: transparent; color: #c4b5fd; border-color: #6d28d9; }
[data-theme="dark"] .dbc-add--tpl { background: #221f29; border-color: #2c2833; }
[data-theme="dark"] .dbc-basis li { color: #8a8271; }
[data-theme="dark"] .dbc-basis code { background: #221f29; color: #c4b5fd; }
