/* ==========================================================================
   体表面积计算 · 页面专属样式
   设计意图：右边是一张「给药换算单」——大字是 BSA，下面五条公式横条并排，
   再往下是折算后的总剂量与体重曲线，像化疗方案附页。
   仅本页引用。
   ========================================================================== */

.bsa-desk {
    display: grid;
    grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
    gap: 20px;
    align-items: start;
    margin-top: 26px;
}

.bsa-desk > * { min-width: 0; }

.bsa-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 13px 14px;
}

.bsa-span-2 { grid-column: span 2; }

/* ---------- 性别胶囊 ---------- */
.bsa-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.bsa-chips label { display: inline-flex; cursor: pointer; user-select: none; }

.bsa-chips input {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
}

.bsa-chips label span {
    display: inline-block;
    padding: 6px 12px;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--d3-ink-2);
    background: var(--d3-paper);
    border: 1px solid var(--d3-line-2);
    border-radius: 999px;
    white-space: nowrap;
    transition: background .14s ease, border-color .14s ease, color .14s ease;
}

.bsa-chips label:hover span { border-color: var(--d3-accent); color: var(--d3-accent); }

.bsa-chips input:checked + span {
    background: var(--d3-accent);
    border-color: var(--d3-accent);
    color: var(--d3-accent-ink);
}

.bsa-chips input:focus-visible + span {
    outline: 2px solid rgba(var(--d3-accent-rgb), .55);
    outline-offset: 2px;
}

.bsa-chips-sm { padding-top: 2px; }
.bsa-chips-sm label span { padding: 8px 14px; }

/* ---------- 按钮 ---------- */
.bsa-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px dashed var(--d3-line);
}

.bsa-btn {
    appearance: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 650;
    line-height: 1;
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid var(--d3-accent);
    background: var(--d3-accent);
    color: var(--d3-accent-ink);
    transition: filter .15s ease, background .15s ease, color .15s ease, border-color .15s ease;
}

.bsa-btn:hover { filter: brightness(1.06); }

.bsa-btn-ghost {
    background: transparent;
    border-color: var(--d3-line-2);
    color: var(--d3-ink-2);
}

.bsa-btn-ghost:hover {
    border-color: var(--d3-accent);
    color: var(--d3-accent);
    background: rgba(var(--d3-accent-rgb), .06);
    filter: none;
}

/* ---------- 提示 ---------- */
.bsa-alerts { display: grid; gap: 8px; margin-top: 14px; }
.bsa-alerts:empty { display: none; }

.bsa-alert {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 9px 12px;
    font-size: 12.5px;
    line-height: 1.6;
    border-radius: 8px;
    border: 1px solid var(--d3-line-2);
    background: var(--d3-paper-2);
    color: var(--d3-ink-2);
}

.bsa-alert::before {
    content: "";
    flex: none;
    width: 6px;
    height: 6px;
    margin-top: 6px;
    border-radius: 50%;
    background: var(--d3-ink-3);
}

.bsa-alert.is-warn { border-color: rgba(168, 84, 26, .4); background: rgba(168, 84, 26, .07); color: var(--d3-warn); }
.bsa-alert.is-warn::before { background: var(--d3-warn); }
.bsa-alert.is-bad { border-color: rgba(176, 42, 36, .38); background: rgba(176, 42, 36, .07); color: var(--d3-bad); }
.bsa-alert.is-bad::before { background: var(--d3-bad); }

/* ---------- 结果 ---------- */
.bsa-result {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    min-width: 0;
}

.bsa-result > * { min-width: 0; }

.bsa-readout {
    position: relative;
    padding: 15px 18px 15px;
    background: var(--d3-card);
    border: 1px solid var(--d3-line);
    border-radius: var(--d3-radius);
    overflow: hidden;
}

.bsa-readout::before {
    content: "";
    position: absolute;
    left: 0; top: 0; right: 0;
    height: 3px;
    background: linear-gradient(to right, var(--d3-accent), rgba(var(--d3-accent-rgb), .1));
}

.bsa-readout-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.bsa-kicker {
    font-family: var(--d3-mono);
    font-size: 10px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--d3-ink-3);
}

.bsa-badge {
    font-family: var(--d3-mono);
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1;
    padding: 5px 8px;
    border-radius: 999px;
    border: 1px solid rgba(var(--d3-accent-rgb), .4);
    color: var(--d3-accent);
    background: rgba(var(--d3-accent-rgb), .07);
    white-space: nowrap;
}

.bsa-big {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin: 8px 0 0;
    font-family: var(--d3-mono);
    font-variant-numeric: tabular-nums;
    font-size: clamp(38px, 5.2vw, 52px);
    font-weight: 700;
    line-height: 1.02;
    letter-spacing: -.045em;
    color: var(--d3-ink);
}

.bsa-big small {
    font-family: var(--d3-sans);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0;
    color: var(--d3-ink-3);
}

.bsa-big-note {
    margin: 6px 0 0;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--d3-ink-3);
}

/* ---------- 公式对比条 ---------- */
.bsa-formula-rows {
    display: grid;
    gap: 9px;
    margin-top: 15px;
    padding-top: 13px;
    border-top: 1px dashed var(--d3-line);
}

.bsa-frow { display: grid; gap: 4px; }

.bsa-frow-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    color: var(--d3-ink-2);
}

.bsa-frow-top b {
    font-family: var(--d3-mono);
    font-size: 12px;
    font-weight: 650;
    color: var(--d3-ink);
    font-variant-numeric: tabular-nums;
}

.bsa-frow-top em {
    font-style: normal;
    font-family: var(--d3-mono);
    font-size: 10.5px;
    color: var(--d3-ink-3);
    margin-left: 5px;
}

.bsa-frow.is-cur .bsa-frow-top span { color: var(--d3-accent); font-weight: 650; }

.bsa-frow-bar {
    height: 5px;
    border-radius: 999px;
    background: var(--d3-paper-2);
    overflow: hidden;
}

.bsa-frow-bar i {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: rgba(var(--d3-accent-rgb), .28);
    transition: width .25s ease;
}

.bsa-frow.is-cur .bsa-frow-bar i { background: var(--d3-accent); }

/* ---------- 剂量卡 ---------- */
.bsa-dose {
    padding: 12px 16px 13px;
    background: var(--d3-card);
    border: 1px dashed var(--d3-line-2);
    border-radius: var(--d3-radius);
}

.bsa-dose-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    font-size: 11.5px;
    color: var(--d3-ink-3);
}

.bsa-dose-head span:last-child {
    font-family: var(--d3-mono);
    font-size: 11px;
    color: var(--d3-accent);
}

.bsa-dose-big {
    display: flex;
    align-items: baseline;
    gap: 5px;
    margin: 5px 0 0;
    font-family: var(--d3-mono);
    font-variant-numeric: tabular-nums;
    font-size: 27px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -.03em;
    color: var(--d3-ink);
}

.bsa-dose-big small {
    font-family: var(--d3-sans);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
    color: var(--d3-ink-3);
}

.bsa-dose-note {
    margin: 4px 0 0;
    font-size: 12px;
    line-height: 1.6;
    color: var(--d3-ink-3);
}

/* ---------- 曲线 ---------- */
.bsa-chart-wrap {
    padding: 12px 14px 5px;
    background: var(--d3-card);
    border: 1px solid var(--d3-line);
    border-radius: var(--d3-radius);
}

.bsa-chart-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 3px;
}

.bsa-chart-head h3 { font-size: 13px; font-weight: 650; }

.bsa-chart-head span {
    font-family: var(--d3-mono);
    font-size: 10.5px;
    color: var(--d3-ink-3);
    white-space: nowrap;
}

#bsaChart {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

#bsaChart .bsa-grid-line { stroke: var(--d3-line); stroke-width: 1; }
#bsaChart .bsa-axis-text {
    fill: var(--d3-ink-3);
    font-family: var(--d3-mono);
    font-size: 10px;
}
#bsaChart .bsa-area { fill: rgba(var(--d3-accent-rgb), .12); }
#bsaChart .bsa-line {
    fill: none;
    stroke: var(--d3-accent);
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
}
#bsaChart .bsa-dot { fill: var(--d3-card); stroke: var(--d3-accent); stroke-width: 2.4; }
#bsaChart .bsa-dot-text { fill: var(--d3-ink); font-family: var(--d3-mono); font-size: 10.5px; font-weight: 700; }

/* ---------- 指标 ---------- */
.bsa-kv {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    margin: 0;
    background: var(--d3-line);
    border: 1px solid var(--d3-line);
    border-radius: var(--d3-radius);
    overflow: hidden;
}

.bsa-kv > div { padding: 9px 13px 10px; background: var(--d3-card); }

.bsa-kv dt {
    font-size: 11.5px;
    color: var(--d3-ink-3);
    margin-bottom: 3px;
}

.bsa-kv dd {
    margin: 0;
    font-family: var(--d3-mono);
    font-variant-numeric: tabular-nums;
    font-size: 15px;
    font-weight: 650;
    color: var(--d3-ink);
}

/* ---------- 表格 ---------- */
.bsa-table-wrap { margin-top: 34px; }

.bsa-sec-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.bsa-sec-head h2 { font-size: var(--d3-fs-h2); letter-spacing: -.02em; }

.bsa-sec-head span {
    font-family: var(--d3-mono);
    font-size: 11px;
    color: var(--d3-ink-3);
    text-align: right;
}

.bsa-table td:first-child { font-weight: 650; color: var(--d3-ink); white-space: nowrap; }
.bsa-table td:nth-child(2) { font-family: var(--d3-mono); font-size: 11.5px; color: var(--d3-ink-3); }
.bsa-table td:nth-child(3) { font-family: var(--d3-mono); font-variant-numeric: tabular-nums; color: var(--d3-accent); font-weight: 650; }
.bsa-table tr.is-cur td { background: rgba(var(--d3-accent-rgb), .07); }

/* ---------- 响应式 ---------- */
@media (max-width: 960px) {
    .bsa-desk { grid-template-columns: minmax(0, 1fr); }
    .bsa-result { order: -1; }
}

@media (max-width: 640px) {
    .bsa-grid { grid-template-columns: minmax(0, 1fr); }
    .bsa-span-2 { grid-column: auto; }
    .bsa-kv { grid-template-columns: minmax(0, 1fr); }
    .bsa-big { font-size: 40px; }
    .bsa-sec-head { display: block; }
    .bsa-sec-head span { display: block; margin-top: 4px; text-align: left; }
}
