/* ==========================================================================
   工具页样式 · 浅蓝工程风（依赖 ../assets/theme.css）
   ========================================================================== */

.page {
    max-width: 820px;
    margin: 0 auto;
    padding: 24px 20px 30px;
}

/* ---------- 面包屑 ---------- */
.crumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 16px;
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: .02em;
    color: var(--text-dim);
}
.crumbs a { color: var(--text-dim); }
.crumbs a:hover { color: var(--cyan); }
.crumbs .sep { opacity: .5; }

/* ---------- 标题 ---------- */
.head { margin-bottom: 20px; }
.head h1 {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 11px;
    font-family: var(--sans);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: .02em;
    margin-bottom: 8px;
    color: #123e50;
}
.head p {
    margin: 0;
    font-size: 13.8px;
    color: var(--text-mid);
}

/* ---------- 输入区 ---------- */
.panel {
    padding: 20px;
    margin-bottom: 14px;
}
.panel > h2 {
    display: flex;
    align-items: center;
    gap: 9px;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--cyan);
    margin-bottom: 18px;
}
.panel > h2::before {
    content: '▸';
    font-size: 12px;
    opacity: .8;
}
.panel > h2::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, #c9dde4, transparent);
}

.fields {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}
.fields.one { grid-template-columns: 1fr; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label {
    font-size: 13px;
    color: var(--text-mid);
    letter-spacing: .02em;
}
.field > label small { color: var(--text-dim); font-size: 11.5px; }

/* 输入框：白底圆角，聚焦蓝边 */
.iw {
    position: relative;
    display: flex;
    align-items: stretch;
    background: #ffffff;
    border: 1px solid #b9ccd4;
    border-radius: 7px;
    transition: border-color .18s, box-shadow .18s;
}
.iw:focus-within {
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(17, 103, 129, .10);
}
.iw input, .iw select {
    flex: 1;
    min-width: 0;
    padding: 11px 12px;
    font-family: var(--mono);
    font-size: 16px;             /* iOS 聚焦不放大页面的下限 */
    color: var(--text);
    background: transparent;
    border: 0;
    outline: none;
    -moz-appearance: textfield;
}
.iw select { font-family: var(--sans); font-size: 15px; cursor: pointer; }
.iw select option { background: #fff; color: var(--text); }
.iw input::-webkit-outer-spin-button,
.iw input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.iw input::placeholder { color: var(--text-dim); font-family: var(--sans); font-size: 13px; }
.iw .unit {
    display: flex;
    align-items: center;
    padding: 0 12px;
    font-family: var(--mono);
    font-size: 12.5px;
    letter-spacing: .02em;
    color: var(--text-dim);
    background: #f0f6f8;
    border-left: 1px solid var(--line);
    white-space: nowrap;
}

/* ---------- 结果区：白底工程读数卡 ---------- */
.result {
    position: relative;
    padding: 20px;
    margin-bottom: 14px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--glow-soft);
}
.result .rows { display: grid; gap: 13px; }
.result .row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding-bottom: 11px;
    border-bottom: 1px dashed #dce6ea;
}
.result .row:last-child { padding-bottom: 0; border-bottom: 0; }
.result .row .k {
    flex: 1;
    min-width: 0;
    font-size: 13.5px;
    color: var(--text-mid);
}
.result .row .v {
    font-family: var(--mono);
    font-size: 23px;
    font-weight: 700;
    color: #0d5a72;
    font-variant-numeric: tabular-nums;
    letter-spacing: .01em;
}
.result .row .u {
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: .03em;
    color: var(--text-dim);
    min-width: 52px;
}
.result .row.big .v {
    font-size: 34px;
    color: #0d5a72;
}
.result .row.sub .v {
    font-size: 17px;
    color: var(--text);
    font-weight: 500;
}

.acts {
    display: flex;
    gap: 9px;
    margin-top: 16px;
    padding-top: 15px;
    border-top: 1px solid var(--line-soft);
}
.acts .btn { flex: 1; min-height: 42px; font-size: 13px; }

/* ---------- 公式：浅底等宽代码块 ---------- */
.formula {
    position: relative;
    padding: 15px 18px;
    margin-bottom: 14px;
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.95;
    color: #0d5a72;
    background: #f4f9fb;
    border: 1px solid var(--line);
    border-left: 3px solid var(--violet);
    border-radius: 6px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}
.formula .lb { color: var(--text-dim); }

/* ---------- 说明 ---------- */
.tips {
    padding: 16px 18px;
    font-size: 13.2px;
    line-height: 1.9;
    color: var(--text-mid);
    background: #f6fafb;
    border: 1px solid var(--line);
    border-radius: 8px;
}
.tips b { color: var(--cyan); font-weight: 600; }
.tips ul { margin: 7px 0 0; padding-left: 19px; }
.tips li { margin-bottom: 5px; }

/* ---------- 数据表（型钢查表） ---------- */
.tblwrap {
    overflow-x: auto;
    margin: 0 -4px;
    -webkit-overflow-scrolling: touch;
}
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
table.data th, table.data td {
    padding: 9px 10px;
    text-align: left;
    border-bottom: 1px solid var(--line-soft);
    white-space: nowrap;
}
table.data th {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--cyan);
    background: #eef5f7;
    border-bottom: 1px solid #cfe0e6;
    position: sticky;
    top: 0;
}
table.data td { font-family: var(--mono); font-variant-numeric: tabular-nums; }
table.data td.n { color: var(--text); }
table.data td.w {
    color: var(--cyan);
    font-weight: 500;
}
table.data tbody tr:nth-child(even) { background: #fafcfd; }
table.data tbody tr:hover { background: #f0f7f9; }
table.data tbody tr.hi {
    background: #e5f1f4;
    box-shadow: inset 3px 0 0 var(--cyan);
}
table.data tbody tr.hi td.w { color: #0d5a72; font-weight: 700; }

/* ---------- 分类切换 ---------- */
.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 16px;
}
.tabs button {
    padding: 8px 15px;
    min-height: 38px;
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .02em;
    color: var(--text-mid);
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 7px;
    cursor: pointer;
    transition: color .16s, background .16s, border-color .16s;
}
.tabs button:hover {
    color: var(--cyan);
    border-color: #a9c6d2;
    background: #f3f9fb;
}
.tabs button.on {
    color: #fff;
    font-weight: 700;
    background: var(--cyan);
    border-color: var(--cyan);
    box-shadow: 0 4px 12px rgba(17, 103, 129, .22);
}

/* ---------- 工具箱列表页 ---------- */
.tgrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}
/* grid item 默认 min-width:auto 会被卡片 nowrap 描述文本的 min-content 撑破列轨，
   显式归 0，让列宽由轨道决定，长文本交给卡片内 ellipsis 裁切 */
.tgrid > * { min-width: 0; }

/* ---------- 放坡规则提示条 ---------- */
.ruleHint {
    font-size: 13px;
    line-height: 1.85;
    color: var(--text-mid);
    background: #f5f9fb;
    border: 1px dashed #c7d6dd;
    border-radius: 6px;
    padding: 9px 13px;
    margin: -2px 0 14px;
}
.ruleHint b { color: #0d5a72; font-weight: 600; }
.ruleHint .ruleNote { color: #8a4b1d; font-weight: 500; }
.ruleHint .lockedTag { display:inline-block; padding:0 6px; border-radius:4px; background:#f0d0a0; color:#7a4a1a; font-size:11px; margin-left:4px; font-weight:600; }

/* ---------- 控件自锁（H<放坡起点时强制 k=0） ---------- */
.field--locked > label::after {
    content: ' · 按规范已锁定';
    color: #b4905a;
    font-size: 11px;
    margin-left: 4px;
    font-weight: 600;
}
.field--locked input[type=number] {
    background: #f0f4f6 !important;
    color: #9aa6ad !important;
    cursor: not-allowed;
}
.field--locked .unit { color: #b6c0c4; }

/* ---------- 几何识别警示（B/L 比例与 B 越界） ---------- */
.shapeWarn {
    margin: -6px 0 14px;
    padding: 9px 13px;
    border-radius: 6px;
    background: #fff5e6;
    border: 1px solid #f0c898;
    color: #6a3810;
    font-size: 13px;
    line-height: 1.6;
    display: none;
}
.shapeWarn.show { display: block; }
.shapeWarn b { color: #6a3810; font-weight: 600; }
.shapeWarn button {
    background: #7a4a1a;
    color: #fff;
    border: 0;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 12px;
    margin-left: 10px;
    cursor: pointer;
    font-family: inherit;
}
.shapeWarn button:hover { background: #5e3310; }
.shapeWarn button.ghost {
    background: transparent;
    color: #7a4a1a;
    border: 1px solid #cba580;
}
.shapeWarn button.ghost:hover { background: #ffe9d2; }

/* ---------- 结果标题 ---------- */
.result-h {
    font-size: 14px;
    font-weight: 600;
    color: #0d5a72;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #dce6ea;
    letter-spacing: .04em;
}

/* ---------- 放坡 / 工作面规则表 ---------- */
.sub-h {
    font-size: 14.5px;
    font-weight: 600;
    color: #0d5a72;
    margin: 16px 0 8px;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
}
.sub-h small {
    font-weight: 400;
    font-size: 12px;
    color: var(--text-dim);
}
.tbl-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 6px;
}
.rules-tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: #fbfdfe;
    border: 1px solid var(--line);
    border-radius: 6px;
    overflow: hidden;
}
.rules-tbl th,
.rules-tbl td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #e6eef1;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.rules-tbl th {
    background: #eef4f7;
    font-weight: 600;
    color: #0d5a72;
    font-size: 12px;
    letter-spacing: .03em;
}
.rules-tbl tr:last-child td { border-bottom: 0; }
.rules-tbl tbody tr:nth-child(even) td { background: #f5f9fb; }
.rules-note {
    margin-top: 14px;
    padding: 11px 14px;
    background: #fbf6e9;
    border-left: 3px solid #d4a14a;
    border-radius: 0 6px 6px 0;
    font-size: 13px;
    line-height: 1.85;
    color: var(--text-mid);
}
.rules-note b { color: #8a4b1d; font-weight: 600; }

/* ---------- 移动端 ---------- */
@media (max-width: 640px) {
    .page { padding: 16px 14px 24px; }
    .head h1 { font-size: 20px; gap: 8px; }
    .panel { padding: 16px 14px; }
    .fields { grid-template-columns: 1fr; gap: 13px; }
    .result { padding: 16px 14px; }
    .result .row { flex-wrap: wrap; }
    .result .row .v { font-size: 21px; }
    .result .row.big .v { font-size: 29px; }
    .result .row .u { min-width: 0; }
    .acts { flex-direction: column; }
    .formula { font-size: 12px; padding: 13px 14px; }
    /* minmax(0,1fr)：1fr 会尊重内容 min-content 被长描述撑破（390px 下第二列溢出屏外），
       minmax(0,·) 强制轨道均分容器，溢出交给 .tool .t span 的 ellipsis */
    .tgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    table.data th, table.data td { padding: 8px 7px; font-size: 12px; }
    .tabs button { padding: 8px 12px; font-size: 12px; }
}

/* ==========================================================================
   图形版计算器组件（左参数 / 右示意图+KPI，带 SVG 尺寸联动）
   2026-09-02 混凝土方量页引入 · 全站共享组件，勿在页面内联重写
   ========================================================================== */
.page.wide { max-width: 1180px; }

.gcalc {
    display: grid;
    grid-template-columns: 392px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
    margin-bottom: 18px;
}
.gcalc > * { min-width: 0; }

/* trench 页专用双栏微调(参数字段多,左栏加宽+字段恢复 2 列,
   右栏 KPI 改 2×2 让卡片更舒展,左右栏高度基本平衡) */
.gcalc.trench { grid-template-columns: 540px minmax(0, 1fr); gap: 14px; }
.gcalc.trench .fields { grid-template-columns: 1fr 1fr; gap: 12px; }
.gcalc.trench .kpis { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) {
    .gcalc.trench { grid-template-columns: 480px minmax(0, 1fr); }
}

/* trench 专属双栏(针对 trench 字段密度定制:左 440px 参数栏 + 右 1fr 示意区)
   与 concrete 的 .gcalc 独立,互不干扰;≤980px 自动单排 */
.trench-2col {
    display: grid;
    grid-template-columns: 480px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    max-width: 1180px;
    margin: 0 auto;
}
.trench-2col > * { min-width: 0; }           /* 防内容溢出撑破格子 */
/* 关键:列宽必须 minmax(0,1fr)——用 1fr 时长的 <select> 内容会撑宽列,
   把同行字段挤到右边溢出左栏、压到右栏 SVG 上(实测 #mat right=749 > figbody.x=560) */
.trench-2col .fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.trench-2col .fields .iw { min-width: 0; }
.trench-2col .fields select,
.trench-2col .fields input { max-width: 100%; min-width: 0; }
/* 右栏:横断面 / 俯视 / KPI 顺序堆叠 */
.trench-2col .col-right { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.trench-2col .col-right .gside { display: block; margin: 0; }
@media (max-width: 1100px) {
    .trench-2col { grid-template-columns: 400px minmax(0, 1fr); }
}
@media (max-width: 980px) {
    .trench-2col { grid-template-columns: 1fr; }
    .trench-2col .fields { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 980px) {
    .gcalc.trench { grid-template-columns: 1fr; }
    .gcalc.trench .fields { grid-template-columns: 1fr; }
}

/* 左侧输入卡内小调整 */
.gcalc .tabs { gap: 7px; }
.gcalc .tabs button {
    flex: 1 1 31%;
    min-height: 40px;
    padding: 8px 6px;
    font-size: 12.5px;
    text-align: center;
}
/* gcalc 内的输入参数区：单列纵向堆叠（每行一个字段），避免双列挤窄 */
.gcalc .fields { grid-template-columns: 1fr; gap: 11px; }
.gcalc .fields + .fields { margin-top: 15px; }
.gcalc .hint {
    margin-top: 12px;
    font-size: 11.5px;
    line-height: 1.75;
    color: var(--text-dim);
}

/* ---------- 示意图卡 ---------- */
.figbox {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 14px;
    box-shadow: var(--glow-soft);
}
.fighead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .06em;
    color: #24515e;
    background: #f6fafb;
}
.fighead-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.fighead .sub {
    font-family: var(--sans);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0;
    color: var(--text-dim);
}
.figbody {
    padding: 12px 10px 6px;
    background: #fbfdfe;
    overflow-x: auto;
}
/* svg 跟随容器宽度自动缩放，绝不强制 min-width（否则窄屏把右栏撑爆，会盖住左栏输入框） */
.figbody svg {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
}
.figbody text {
    font-family: var(--mono), 'Microsoft YaHei', sans-serif;
}
/* 平面俯视独立 SVG(双栏 trench 专用,与横断面物理分离避免视觉重叠) */
.figplan {
    padding: 6px 10px 10px;
    background: #fbfdfe;
    border-top: 1px dashed #c0d1d9;
    display: flex;
    justify-content: center;
}
.figplan svg {
    display: block;
    width: 100%;
    max-width: 240px;
    height: auto;
}
.figplan text {
    font-family: var(--mono), 'Microsoft YaHei', sans-serif;
}
.figlegend {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 18px;
    align-items: center;
    padding: 8px 14px;
    border-top: 1px solid var(--line);
    color: var(--text-dim);
    font-size: 11px;
    background: #fff;
}
.figlegend i {
    display: inline-block;
    width: 14px;
    height: 8px;
    border-radius: 2px;
    margin-right: 5px;
    vertical-align: -1px;
}
.figlegend .dim { color: #116781; }

/* ---------- KPI 读数条 ---------- */
.kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 14px;
    min-width: 0;                  /* grid 容器防溢出兜底（与砖砌检查井的 .summary 同源做法） */
}
.kpi {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 11px 13px;
    box-shadow: var(--glow-soft);
    min-width: 0;                  /* grid item 默认 min-width:auto，nowrap 文字会把列撑爆 */
}
.kpi .k {
    font-size: 11px;
    color: var(--text-dim);
    letter-spacing: .03em;
    margin-bottom: 3px;
    overflow-wrap: anywhere;       /* 不再 white-space:nowrap；窄屏长标题可折行，仿砖砌检查井 .kpi 自由换行 */
}
.kpi .v {
    font-family: var(--mono);
    font-size: 22px;
    font-weight: 700;
    color: #0d5a72;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}
.kpi .u {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-dim);
    margin-left: 2px;
}
.kpi.hl { border-color: #9fc6d2; background: #f0f8fa; }
.kpi.hl .v { color: #0a4a5e; }

/* 右侧纵列容器 */
.gside { display: flex; flex-direction: column; min-width: 0; }

/* 随形体切换的构件说明卡 */
.usecase {
    margin-top: 14px;
    background: #f6fafb;
    border: 1px solid var(--line);
    border-left: 3px solid var(--cyan);
    border-radius: 8px;
    padding: 13px 16px;
    font-size: 13px;
    line-height: 1.9;
    color: var(--text-mid);
}
.usecase b { color: var(--cyan); font-weight: 600; }
.usecase p { margin: 0 0 7px; }
.usecase p:last-child { margin-bottom: 0; }
.usecase .urow { margin: 4px 0; }
.usecase .urow .flabel {
    display: inline-block;
    min-width: 64px;
    color: var(--text);
    font-weight: 600;
}

@media (max-width: 980px) {
    /* 单列：svg 基础规则已是 width:100%/max-width:100%，此处不再设任何 min-width */
    .gcalc { grid-template-columns: 1fr; }
    .kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .page.wide { padding: 14px 10px 22px; }
    .gcalc { gap: 14px; margin-bottom: 12px; }
    /* 6 个形体 tab：grid 3 列硬切 3+3，比 flex wrap 更可控（仿砖砌检查井 .tabs grid 做法） */
    .gcalc .tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .gcalc .tabs button { flex: none; min-width: 0; min-height: 36px; padding: 7px 4px; font-size: 11.5px; }
    .gcalc .fields { gap: 11px; }
    .kpis { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .kpi { padding: 9px 10px; }
    .kpi .v { font-size: 19px; }
    .kpi .k { font-size: 10.5px; }
    .figbox { margin-bottom: 12px; }
    .figbody { padding: 8px 4px 2px; }
    .fighead { padding: 8px 10px; font-size: 11px; }
    .figlegend { padding: 6px 10px; font-size: 10px; gap: 3px 12px; }
    .usecase { margin-top: 12px; padding: 11px 13px; font-size: 12.5px; line-height: 1.85; }
    .usecase .urow .flabel { min-width: 56px; }
}

/* ---------- 回填砂三层参数化(layer_bed/side/top) ---------- */
.sand-layer {
    /* 父容器 .fields 是 2 列 grid——卡片必须跨满整行才能三层垂直堆叠,
       否则每张卡被切成半宽、与放坡系数等字段交错排布(用户反馈的布局问题) */
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    background: #f6f8f9;
    border: 1px solid #c0d1d9;
    border-radius: 7px;
    /* 不再用 margin-bottom:grid gap 15px 已承担卡片行间距,二者叠加会过宽 */
}
.sand-layer.is-off { background: #fafbfc; border-style: dashed; }
.sand-layer.is-off .layer-params { opacity: .35; pointer-events: none; }
.sand-layer .layer-head {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.sand-layer .ck {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    font-size: 13.5px;
    color: var(--text-mid);
    user-select: none;
    flex-shrink: 0;
}
.sand-layer .ck input { width: 17px; height: 17px; cursor: pointer; accent-color: var(--cyan); }
.sand-layer .ck span small { color: var(--text-dim); font-weight: 400; margin-left: 3px; }
.sand-layer .layer-head input[type="text"] {
    flex: 1;
    min-width: 80px;
    max-width: 180px;
    padding: 7px 11px;
    font-family: var(--sans);
    font-size: 13.5px;
    color: var(--text);
    background: #ffffff;
    border: 1px solid #b9ccd4;
    border-radius: 6px;
    outline: none;
    transition: border-color .18s, box-shadow .18s;
}
.sand-layer .layer-head input[type="text"]:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(17, 103, 129, .10);
}
.sand-layer .layer-params {
    display: grid;
    grid-template-columns: minmax(0,1fr) minmax(0,1fr);   /* minmax(0,1fr): 防 grid item min-width:auto 撑爆列(每侧外扩栏溢出修复) */
    gap: 10px;
}
.sand-layer .layer-params .field { min-width: 0; }        /* grid item 兜底,允许收缩 */
.sand-layer .layer-params .field > label { overflow-wrap: anywhere; }  /* label 过长可换行,不撑宽 */
.sand-layer .layer-params:has(.field:only-child) {
    grid-template-columns: 1fr;
}
.sand-layer.is-off .layer-head input[type="text"] { background: #f1f3f5; color: var(--text-dim); }

@media (max-width: 700px) {
    .sand-layer .layer-params { grid-template-columns: 1fr; }
}

/* ============ 打印: A4 计算书单列排版 ============
   使用: 用户点页面"打印计算书"按钮或 Ctrl+P 触发,
   输出 A4 单列 = 标题 + 项目参数 + 横断面图 + 平面俯视图 + 关键体积 + 清单列项 */
@media print {
    /* A4 纵向 + 适中页边 */
    @page { size: A4 portrait; margin: 16mm 14mm 18mm 14mm; }

    /* === 隐藏 UI(导航/按钮/复选框/交互控件) === */
    .topbar, .navbar, .crumbs, .breadcrumb, .toolbox-tabs, .copy-hint,
    .fighead button, .btn, .actions, .toolbar,
    .no-print { display: none !important; }

    /* === 基础排版 === */
    html, body {
        background: #fff !important;
        color: #000 !important;
        font-size: 10.5pt;
        line-height: 1.45;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* === 卡片去装饰,适合白纸 === */
    .card, .panel {
        background: #fff !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 0 10pt !important;
        page-break-inside: avoid;
        break-inside: avoid;
    }

    /* === 双栏强制单列 === */
    .trench-2col, .gcalc.trench, .gcalc { display: block !important; }
    .col-right, .gside { width: 100% !important; max-width: 100% !important; }
    .trench-2col > .card, .trench-2col > .col-right > .card { width: 100% !important; }

    /* === 标题 === */
    h1 { font-size: 16pt !important; margin: 0 0 8pt !important; padding: 0 !important; }
    h2 { font-size: 12pt !important; margin: 12pt 0 4pt !important; padding: 0 !important;
         border-bottom: 1.5pt solid #000 !important; }

    /* === 项目参数(只读化) ===
       输入框/下拉 → 去边框/底色,只显示值;label 后跟值,两列排 */
    .field label small { display: none !important; }
    .iw {
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
        border-radius: 0 !important;
    }
    .iw input, .iw select,
    .field input, .field select {
        border: none !important;
        background: transparent !important;
        padding: 0 !important;
        color: #000 !important;
        font-size: 10.5pt !important;
        -webkit-appearance: none !important;
        appearance: none !important;
    }
    .iw::after { display: none !important; }
    .fields {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 3pt 12pt !important;
        margin-top: 4pt !important;
    }
    .field { margin: 0 !important; }

    /* === 砂层复选框去掉,只显文字+参数 === */
    .ck input[type="checkbox"] { display: none !important; }
    .ck span, .ck span small { display: inline !important; opacity: 1 !important; }
    .sand-layer {
        border: 0.6pt solid #999 !important;
        border-radius: 3pt !important;
        padding: 5pt 8pt !important;
        margin: 0 0 5pt !important;
        background: #fafafa !important;
    }
    .layer-head { display: flex !important; align-items: center !important; gap: 6pt !important; margin-bottom: 3pt !important; }
    .layer-params { display: flex !important; gap: 14pt !important; }
    .layer-params .field { display: flex !important; align-items: baseline !important; gap: 3pt !important; }
    .layer-params .field label { display: inline !important; }
    .layer-params .iw { display: inline !important; }

    /* === 自动查表结果提示(必须留,审计要) === */
    .ruleHint {
        font-size: 9pt !important;
        background: #f5f5f5 !important;
        border: 0.6pt dashed #999 !important;
        padding: 5pt 8pt !important;
        margin: 8pt 0 !important;
        line-height: 1.5 !important;
    }

    /* === 横断面图 + 俯视图 全宽 === */
    .figbox, .gside > .figbox { padding: 0 !important; margin: 0 !important; }
    .fighead { padding: 0 !important; margin-bottom: 4pt !important; }
    .figTitle { font-size: 11pt !important; font-weight: 700 !important; }
    .figSubtitle { font-size: 9pt !important; color: #555 !important; }
    .figbody, .figplan { width: 100% !important; padding: 0 !important; }
    .figbody svg, .figplan svg {
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
    }
    /* 俯视图原始 viewBox 小(约220px宽),全宽拉伸会比例失调 → 限宽居中 */
    .figplan { max-width: 300px !important; margin: 0 auto !important; }

    /* === 图例: 一行紧凑 === */
    .figlegend { font-size: 8.5pt !important; padding: 3pt 0 !important; gap: 8pt !important; }
    .figlegend .lg-item { display: inline-flex !important; }

    /* === KPI 4 列 → 2x2 === */
    .kpis {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6pt !important;
        margin-bottom: 0 !important;
    }
    .kpi {
        padding: 6pt 10pt !important;
        border: 0.6pt solid #ccc !important;
        box-shadow: none !important;
        border-radius: 3pt !important;
    }
    .kpi .k { font-size: 9pt !important; margin-bottom: 1pt !important; }
    .kpi .v { font-size: 16pt !important; }
    .kpi .u { font-size: 9pt !important; }

    /* === 清单表: 紧凑 + 表格边框 === */
    .result-tbl {
        font-size: 9pt !important;
        width: 100% !important;
        border-collapse: collapse !important;
    }
    .result-tbl th, .result-tbl td {
        padding: 3pt 5pt !important;
        border: 0.5pt solid #888 !important;
        line-height: 1.35 !important;
    }
    .result-tbl thead th {
        background: #e8e8e8 !important;
        color: #000 !important;
        font-weight: 700 !important;
        text-align: left !important;
    }
    .result-tbl .cellCalc { font-family: var(--mono) !important; font-size: 8.5pt !important; }
    .result-tbl tr { page-break-inside: avoid; break-inside: avoid; }

    /* === 分页控制: 横断面图单独一页,清单可分页 === */
    .figbox { page-break-after: auto; break-after: auto; }
    .card.panel:has(.result-tbl) { page-break-inside: auto; break-inside: auto; }

    /* === 隐藏导航/品牌元素 === */
    .topbar, header, .foot, .site-beian { display: none !important; }

    /* === a 链接去掉下划线/URL === */
    a, a:link, a:visited {
        color: #000 !important;
        text-decoration: none !important;
    }

    /* === 强制背景色打印(Webkit) === */
    * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
}
