/* ============================================================
   框架结构设计计算书 · 样式
   浅色主题 · 工程工具风格
   ============================================================ */

:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-2: #fafbfc;
  --ink: #16202b;
  --ink-2: #5a6673;
  --ink-3: #8b95a1;
  --line: #e3e7ec;
  --line-2: #eef1f4;
  --brand: #0f4c81;
  --brand-2: #1a6aa8;
  --brand-soft: #eaf2f9;
  --ok: #14774a;
  --ok-soft: #e8f5ee;
  --warn: #a9600b;
  --warn-soft: #fdf3e3;
  --danger: #b42318;
  /* 用户需填写的原始数据框（换结构时要改的那些）—— 统一青绿标识 */
  --input-bg: #eef9f5;
  --input-line: #a5d6c6;
  --input-line-h: #79c3ac;
  --input-focus: #0f6b56;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 30, 48, .05), 0 8px 24px -16px rgba(16, 30, 48, .18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

input, select, button { font-family: inherit; font-size: inherit; color: inherit; }

.app { display: flex; min-height: 100vh; }

/* ---------------- 侧栏 ---------------- */
.sidebar {
  width: 252px;
  flex: 0 0 252px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line-2);
}
.brand-mark {
  display: flex; align-items: center; gap: 9px;
  font-weight: 700; letter-spacing: .2px;
}
.brand-mark i {
  width: 22px; height: 22px; border-radius: 6px;
  background: linear-gradient(140deg, var(--brand), #2a86c9);
  display: inline-block; position: relative; flex: 0 0 22px;
}
.brand-mark i::after {
  content: ""; position: absolute; inset: 5px;
  border: 1.6px solid #fff; border-bottom-color: transparent; border-right-color: transparent;
  border-radius: 2px;
}
.brand-dev {
  color: var(--ink-2); font-size: 12px; letter-spacing: .2px;
  margin-top: 6px;
}
.brand-sub { color: var(--ink-3); font-size: 11.5px; margin-top: 3px; letter-spacing: .4px; }

.nav { flex: 1; overflow-y: auto; padding: 10px 10px 24px; }
.nav-item {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 7px 9px; border-radius: 7px;
  color: var(--ink-2); text-decoration: none;
  font-size: 13px; line-height: 1.45;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--panel-2); color: var(--ink); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav-txt b { font-weight: 600; margin-right: 5px; font-size: 11.5px; color: var(--ink-3); }
.nav-item.active .nav-txt b { color: var(--brand); }
.dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #cfd6dd; margin-top: 6px; flex: 0 0 6px;
}
.dot-ok { background: var(--ok); }
.dot-dim { background: #cfd6dd; }
.dot-home { background: var(--brand); opacity: .55; }
.nav-sep { height: 1px; background: var(--line-2); margin: 8px 9px; }

.side-foot {
  padding: 10px 16px 14px; border-top: 1px solid var(--line-2);
  font-size: 11.5px; color: var(--ink-3); line-height: 1.7;
}

/* ---------------- 主区 ---------------- */
.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 54px; flex: 0 0 54px;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
  position: sticky; top: 0; z-index: 30;
}
.top-name {
  font-weight: 600; font-size: 13.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.top-progress {
  margin-left: auto; font-size: 11.5px; color: var(--ink-3);
  border: 1px solid var(--line); border-radius: 20px; padding: 1px 9px;
}
.top-home {
  font-size: 12.5px; color: var(--brand); text-decoration: none;
  border: 1px solid var(--brand-soft); background: var(--brand-soft);
  padding: 4px 11px; border-radius: 6px;
}
.top-home:hover { background: #dfeaf5; }

/* 顶栏「保存全部配置」 */
.top-save {
  flex: 0 0 auto; gap: 5px;
  padding: 6px 13px; font-size: 12.5px; font-weight: 600;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.top-save svg { flex: 0 0 auto; }
.top-save.done {
  background: var(--ok); border-color: var(--ok);
  box-shadow: 0 1px 2px rgba(20, 119, 74, .28);
}
@media (max-width: 720px) {
  .top-save { padding: 6px 9px; }
  .top-save .ts-txt { display: none; }
}

main { padding: 22px; width: 100%; max-width: 1240px; margin: 0 auto; }

/* ---------------- 通用卡片 ---------------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}
.card-muted { background: var(--panel-2); box-shadow: none; }
.card-title { font-size: 14px; margin: 0 0 12px; font-weight: 650; }

/* ---------------- 首页 hero ---------------- */
.hero {
  padding: 20px 22px 18px;
  background: linear-gradient(180deg, #fbfdff, #ffffff 62%);
  border-color: #dbe6f0;
}
.hero-top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.hero-name {
  display: block; width: 100%;
  border: 1px solid transparent; background: transparent;
  font-size: 25px; font-weight: 700; letter-spacing: -.2px;
  padding: 4px 8px; margin: 0 0 2px -8px; border-radius: 7px;
  color: var(--ink);
}
.hero-name:hover { background: #f7fafd; border-color: var(--line); }
.hero-name:focus { outline: none; background: #fff; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(26, 106, 168, .12); }
.hero-sub { display: flex; flex-wrap: wrap; gap: 7px; color: var(--ink-2); font-size: 13px; align-items: center; }
.hero-sub i { color: #c9d2db; font-style: normal; }
.hero-actions { display: flex; gap: 9px; margin-top: 16px; flex-wrap: wrap; }

.save-hint { margin-left: auto; font-size: 11.5px; color: var(--ink-3); transition: color .2s; }
.save-hint.flash { color: var(--ok); }

/* 标签 */
.tag {
  display: inline-block; font-size: 11.5px; line-height: 1.6;
  padding: 1px 8px; border-radius: 20px; font-weight: 600;
  border: 1px solid transparent; white-space: nowrap;
}
.tag-live { background: var(--brand-soft); color: var(--brand); border-color: #d5e5f2; }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-wait { background: #f2f4f6; color: var(--ink-3); }
.tag-lock { background: #eef0f3; color: #78828f; border-color: #dfe3e8; }

/* ---------------- 章节开放控制 ---------------- */
.nav-item.is-locked { opacity: .48; }
.nav-item.is-locked:hover { background: #f7f8fa; color: var(--ink-3); }
.dot-lock { background: #b9c1ca; }
.chap-row.is-locked { opacity: .45; }
.chap-row.is-locked:hover { background: transparent; }
.chap-row.is-locked:hover .chap-no { background: #f1f4f7; color: var(--ink-2); }

.locked-card { text-align: center; padding: 46px 24px 42px; }
.locked-ico { width: 56px; height: 56px; color: #a9b3bf; margin-bottom: 8px; }
.locked-card h2 { margin: 6px 0 10px; font-size: 19px; letter-spacing: .3px; }
.locked-text { margin: 0 0 6px; color: var(--ink-2); font-size: 13.5px; }
.locked-note { margin: 0 0 20px; color: var(--ink-3); font-size: 12.5px; }
.locked-card .btn-row { justify-content: center; }

/* ---------------- 指标卡 ---------------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 12px; margin-bottom: 16px;
}
.stat {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 13px 15px 12px;
  box-shadow: var(--shadow);
}
.stat.accent { border-color: #d8e5f1; background: linear-gradient(180deg, #fbfdff, #fff); }
.stat-label { font-size: 12px; color: var(--ink-3); }
.stat-value {
  font-size: 26px; font-weight: 700; letter-spacing: -.5px;
  font-variant-numeric: tabular-nums; margin-top: 2px;
  display: flex; align-items: baseline; gap: 4px;
}
.stat-value em { font-style: normal; font-size: 12.5px; font-weight: 500; color: var(--ink-3); letter-spacing: 0; }
.stat-hint { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.stat.accent .stat-value { color: var(--brand); }

/* ---------------- 章节列表（首页） ---------------- */
.chap-list { display: flex; flex-direction: column; }
.chap-row {
  display: flex; align-items: center; gap: 13px;
  padding: 10px 8px; border-radius: 8px;
  text-decoration: none; color: inherit;
  border-bottom: 1px solid var(--line-2);
}
.chap-row:last-child { border-bottom: none; }
.chap-row:hover { background: var(--panel-2); }
.chap-no {
  width: 26px; height: 26px; flex: 0 0 26px; border-radius: 7px;
  background: #f1f4f7; color: var(--ink-2);
  display: grid; place-items: center; font-size: 12.5px; font-weight: 600;
}
.chap-row:hover .chap-no { background: var(--brand-soft); color: var(--brand); }
.chap-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.chap-body b { font-size: 13.5px; font-weight: 600; }
.chap-body span { font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.muted { color: var(--ink-3); font-size: 12.5px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* file:// 打开时的环境提示条 */
.env-tip {
  margin: 14px 22px 0; padding: 10px 14px;
  background: var(--warn-soft); border: 1px solid #f0d9b3;
  border-radius: 8px; color: #7a4a08;
  font-size: 12.5px; line-height: 1.65;
}
.env-tip[hidden] { display: none; }
.env-tip b { font-weight: 650; }

/* 当前关联文件提示 */
.file-line {
  margin-top: 9px; font-size: 11.5px; color: var(--ink-3);
  display: flex; align-items: flex-start; gap: 6px;
  flex-wrap: wrap; word-break: break-all; line-height: 1.65;
}
.file-line::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: var(--ink-3); flex: 0 0 auto; margin-top: 6px;
}

/* ---------------- 按钮 ---------------- */
.btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 8px 15px; border-radius: 8px; cursor: pointer;
  font-size: 13px; font-weight: 550; transition: all .13s;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:hover { border-color: #c9d2db; background: #fcfdfe; }
.btn:active { transform: translateY(.5px); }
.btn-primary {
  background: var(--brand); border-color: var(--brand); color: #fff;
  box-shadow: 0 1px 2px rgba(15, 76, 129, .25);
}
.btn-primary:hover { background: #0d4470; border-color: #0d4470; }
.btn-ghost { background: #fff; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn-col { display: flex; flex-direction: column; gap: 8px; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: #f0cfcb; background: #fdf6f5; }
.link {
  border: none; background: none; padding: 0; color: var(--brand-2);
  cursor: pointer; text-decoration: underline; font-size: inherit; text-underline-offset: 2px;
}

/* ---------------- 章节页头 ---------------- */
.ch-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 16px; }
.ch-kicker {
  font-size: 11.5px; letter-spacing: 1.2px; color: var(--brand);
  font-weight: 700; margin-bottom: 1px;
}
.ch-head h1 { font-size: 21px; margin: 0; letter-spacing: -.2px; }
.ch-head .sub { color: var(--ink-2); font-size: 12.5px; margin: 5px 0 0; }
.ch-head > .tag { margin-left: auto; margin-top: 6px; }

/* ---------------- 第1章 布局 ---------------- */
.ch1-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 328px;
  gap: 16px; align-items: start;
}
.ch1-main > .card:last-child { margin-bottom: 0; }
.ch1-side { position: sticky; top: 70px; }

.sec-head { display: flex; align-items: baseline; gap: 9px; margin-bottom: 14px; padding-bottom: 11px; border-bottom: 1px solid var(--line-2); }
.sec-no {
  font-size: 11.5px; font-weight: 700; color: var(--brand);
  background: var(--brand-soft); border-radius: 5px; padding: 1px 6px;
}
.sec-head h2 { font-size: 15px; margin: 0; font-weight: 650; }
.sec-note { margin-left: auto; font-size: 11.5px; color: var(--ink-3); }

.field-group + .field-group,
.fields + .field-group { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line); }
.group-label {
  font-size: 12px; font-weight: 650; color: var(--ink-2);
  margin-bottom: 10px; display: flex; align-items: baseline; gap: 8px;
}
.group-tip { font-weight: 400; color: var(--ink-3); font-size: 11.5px; }

.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.fields.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fields.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fields.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.fields.cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.fields.cols-6 .field label { font-size: 11px; font-weight: 550; letter-spacing: -.1px; white-space: nowrap; }
@media (max-width: 900px) {
  .fields.cols-3, .fields.cols-4, .fields.cols-5, .fields.cols-6 { grid-template-columns: 1fr 1fr; }
}
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field label { font-size: 12.5px; color: var(--ink-2); font-weight: 550; }
.field label .opt {
  font-style: normal; font-size: 10.5px; color: var(--ink-3);
  border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; margin-left: 6px;
  font-weight: 400;
}
.ctrl { display: flex; align-items: center; position: relative; }
.ctrl input[type="number"], .ctrl input[type="text"], .ctrl select {
  width: 100%; height: 38px;
  border: 1px solid var(--input-line); border-radius: 8px;
  background-color: var(--input-bg); padding: 0 11px;
  font-size: 13.5px; transition: border-color .13s, box-shadow .13s;
  font-variant-numeric: tabular-nums;
}
.ctrl select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%238b95a1' stroke-width='1.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 28px;
}
.ctrl input:hover, .ctrl select:hover { border-color: var(--input-line-h); }
.ctrl input.needs-input {
  border-color: #e0b070; background: #fffdf8;
  box-shadow: inset 0 0 0 1px rgba(224, 176, 112, .25);
}
.ctrl input.needs-input:focus { border-color: var(--warn); box-shadow: 0 0 0 3px rgba(169, 96, 11, .12); }
.hint .link { font-size: inherit; }
.hint-warn { color: var(--warn); }
.ctrl input:focus, .ctrl select:focus {
  outline: none; border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(15, 107, 86, .14);
}
/* 只读 / 禁用的输入（不需用户改）恢复灰白，避免与可填写的青绿框混淆 */
.ctrl input:disabled, .ctrl select:disabled {
  background-color: #f2f4f6; border-color: var(--line);
  color: var(--ink-3); cursor: not-allowed;
}
.ctrl input:disabled:hover, .ctrl select:disabled:hover { border-color: var(--line); }
.ctrl input::-webkit-outer-spin-button, .ctrl input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ctrl input[type=number] { -moz-appearance: textfield; }
.unit {
  margin-left: 8px; font-size: 12px; color: var(--ink-3);
  flex: 0 0 auto; min-width: 18px;
}
.hint { font-size: 11.5px; color: var(--ink-3); line-height: 1.5; }

.computed {
  width: 100%; height: 38px; border-radius: 8px;
  border: 1px solid #d6e4f1; background: linear-gradient(180deg, #f4f9fd, var(--brand-soft));
  display: flex; align-items: center; padding: 0 11px;
  font-weight: 700; color: var(--brand); font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.static-val {
  width: 100%; height: 38px; border-radius: 8px;
  border: 1px dashed var(--line); background: var(--panel-2);
  display: flex; align-items: center; padding: 0 11px;
  color: var(--ink-2); font-size: 13.5px;
}

/* 地区检索 */
.region-search { position: relative; margin-bottom: 12px; }
.region-search input {
  width: 100%; height: 38px; border: 1px solid var(--line);
  border-radius: 8px; padding: 0 12px 0 34px; font-size: 13.5px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Ccircle cx='6' cy='6' r='4.2' stroke='%238b95a1' stroke-width='1.4' fill='none'/%3E%3Cpath d='M9.2 9.2L12 12' stroke='%238b95a1' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat 12px center;
}
.region-search input:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(26, 106, 168, .11); }
.region-drop {
  position: absolute; top: 42px; left: 0; right: 0; z-index: 40;
  background: #fff; border: 1px solid var(--line); border-radius: 9px;
  box-shadow: 0 12px 32px -12px rgba(16, 30, 48, .28);
  max-height: 268px; overflow-y: auto; padding: 4px;
}
.drop-item { padding: 7px 10px; border-radius: 6px; cursor: pointer; display: flex; flex-direction: column; }
.drop-item:hover { background: var(--brand-soft); }
.di-place { font-size: 13px; }
.di-val { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.drop-empty { padding: 10px; font-size: 12.5px; color: var(--ink-3); }

/* ---------------- 结果面板 ---------------- */
.result { border-color: #d8e5f1; }
.res-head {
  font-size: 12px; font-weight: 700; color: var(--ink-2);
  letter-spacing: .3px; display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px;
}
.res-head .live {
  margin-left: auto; font-size: 10.5px; font-weight: 600;
  color: var(--ok); background: var(--ok-soft); border-radius: 20px; padding: 0 7px;
  letter-spacing: 0;
}
.res-hero { padding: 2px 0 12px; border-bottom: 1px solid var(--line-2); }
.res-hero-val {
  font-size: 38px; font-weight: 700; letter-spacing: -1.4px;
  color: var(--brand); font-variant-numeric: tabular-nums;
  display: flex; align-items: baseline; gap: 5px; line-height: 1.1;
}
.res-hero-val em { font-style: normal; font-size: 14px; font-weight: 500; color: var(--ink-3); letter-spacing: 0; }
.res-hero-lab { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }

.res-rows { padding: 6px 0 2px; }
.res-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 5px 0; font-size: 12.5px; border-bottom: 1px dashed var(--line-2);
}
.res-row:last-child { border-bottom: none; }
.res-row span { color: var(--ink-3); flex: 0 0 auto; }
.res-row b { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.res-row .mini { color: var(--ink-3); font-weight: 400; font-size: 11.5px; }
.grade { color: var(--brand); font-size: 14px; }

/* 计算过程 */
.calc-line { margin-bottom: 10px; }
.calc-line:last-child { margin-bottom: 0; }
.cl-k { font-size: 11px; color: var(--ink-3); letter-spacing: .3px; }
.cl-v {
  font-size: 12.5px; color: var(--ink-2); line-height: 1.6;
  font-variant-numeric: tabular-nums;
}
.cl-v b { color: var(--ink); }

/* 规范依据 */
.clause { font-size: 12.5px; color: var(--ink-2); }
.clause p { margin: 0 0 8px; }
.clause-p { line-height: 1.65; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 12px; margin: 4px 0 10px; }
.mini-table th, .mini-table td { border: 1px solid var(--line); padding: 4px 6px; text-align: center; }
.mini-table th { background: var(--panel-2); font-weight: 600; color: var(--ink-2); font-size: 11.5px; }
.mini-table tr.cur td { background: var(--brand-soft); color: var(--brand); font-weight: 700; }

/* ---------------- 可编辑参数表（第2章） ---------------- */
.tw-wrap { overflow-x: auto; margin: 2px 0 2px; }
.tw { width: 100%; min-width: 480px; border-collapse: collapse; font-size: 12.5px; }
.tw th, .tw td {
  border-bottom: 1px solid var(--line-2);
  padding: 6px 7px; text-align: center; vertical-align: middle;
}
.tw th {
  background: var(--panel-2); font-weight: 600; color: var(--ink-2);
  font-size: 11.5px; line-height: 1.35; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tw .th-sub { font-weight: 400; color: var(--ink-3); font-size: 10.5px; }
.tw tbody tr:hover { background: #fbfcfe; }
.tw tr.tr-sum { background: var(--panel-2); }
.tw tr.tr-sum td { font-weight: 600; color: var(--ink-2); border-top: 1px solid var(--line); }
.tw tr.tr-sum td.out { color: var(--brand); font-size: 13px; }
.tw .c-no { color: var(--ink-2); font-weight: 600; width: 52px; white-space: nowrap; }
.tw .c-axis { color: var(--ink-3); font-size: 12px; white-space: nowrap; }
.tw .c-dim { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tw .out { font-weight: 650; color: var(--brand); font-variant-numeric: tabular-nums; }
.tw .out.bad { color: var(--warn); }
/* 求和符号：Σ 上方写上界、下方写下界，竖向堆叠 */
.sg {
  display: inline-flex; flex-direction: column; align-items: center;
  vertical-align: middle; line-height: 1.02; margin: 0 3px 0 1px;
}
.sg em { font-style: normal; font-size: 9px; font-weight: 500; }
.sg b { font-weight: 400; font-size: 15px; }
.sg i { font-style: normal; font-size: 9px; font-weight: 500; }
.tw th .sg { margin-bottom: -2px; }
.tw input.cell-in {
  width: 100%; min-width: 58px; height: 32px;
  border: 1px solid var(--input-line); border-radius: 6px; background: var(--input-bg);
  padding: 0 6px; text-align: center; font-size: 13px;
  font-variant-numeric: tabular-nums;
  transition: border-color .13s, box-shadow .13s;
}
.tw input.cell-in:hover { border-color: var(--input-line-h); }
.tw input.cell-in:focus {
  outline: none; border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(15, 107, 86, .14);
}
.tw input.cell-in::-webkit-outer-spin-button,
.tw input.cell-in::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.tw input.cell-in[type=number] { -moz-appearance: textfield; }
.tw .pair { display: flex; align-items: center; gap: 4px; }
.tw .pair i { font-style: normal; color: var(--ink-3); font-size: 11px; flex: 0 0 auto; }
.tag-mini {
  font-style: normal; font-size: 10px; font-weight: 600;
  color: var(--brand); background: var(--brand-soft);
  border-radius: 4px; padding: 0 4px; margin-left: 2px;
}
.ml-auto { margin-left: auto; }

/* ---------------- 第3章：节点明细 / 活载网格 ---------------- */
.nd-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px; margin-top: 14px;
}
.nd-block {
  border: 1px solid var(--line-2); border-radius: 9px;
  padding: 10px 12px 8px; background: #fcfdff;
}
.nd-head {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 12.5px; font-weight: 650; color: var(--ink-1);
  padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px dashed var(--line-2);
}
.nd-total { margin-left: auto; color: var(--brand); font-variant-numeric: tabular-nums; }
.nd-block .calc-line { margin-bottom: 4px; font-size: 11.5px; display: flex; align-items: baseline; gap: 10px; }
.nd-block .calc-line .cl-k { color: var(--ink-3); min-width: 0; flex: 0 0 auto; white-space: nowrap; }
.nd-block .calc-line .cl-v { text-align: right; flex: 1 1 auto; }
.nd-block .calc-line .cl-v .mini { color: var(--ink-3); }

.lv-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px; margin-top: 14px;
}
.lv-cell {
  border: 1px solid var(--line-2); border-radius: 9px;
  padding: 9px 11px; background: #fcfdff;
  display: flex; flex-direction: column; gap: 4px;
}
.lv-cell span { font-size: 11.5px; color: var(--ink-3); line-height: 1.35; }
.lv-cell b {
  font-size: 15px; font-weight: 650; color: var(--brand);
  font-variant-numeric: tabular-nums;
}
.lv-cell b i { font-style: normal; font-size: 10.5px; color: var(--ink-3); margin-left: 3px; font-weight: 400; }

label.chk {
  display: flex; align-items: flex-start; gap: 6px;
  font-size: 11.5px; color: var(--ink-2); cursor: pointer; line-height: 1.5;
}
label.chk input { margin: 2px 0 0; accent-color: var(--brand); }

@media (max-width: 1080px) {
  .nd-grid { grid-template-columns: 1fr; }
  .lv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* ---------------- 计算简图 ---------------- */
.fig-box {
  border: 1px solid var(--line-2); border-radius: 10px;
  background: #fff; padding: 8px 6px 2px;
}
.frame-svg { width: 100%; height: auto; display: block; }
.fig-cap {
  text-align: center; font-size: 12px; color: var(--ink-2);
  margin-top: 8px; display: flex; flex-direction: column; gap: 1px;
}
.fig-cap-sub { color: var(--ink-3); font-size: 11.5px; }

/* 提示条 */
.notice {
  border-radius: 8px; padding: 9px 11px; font-size: 12px; line-height: 1.6;
  margin-top: 10px; border: 1px solid transparent;
}
.notice p { margin: 0 0 4px; }
.notice p:last-child { margin: 0; }
.notice-info { background: var(--brand-soft); border-color: #d5e5f2; color: #14507d; }
.notice-warn { background: var(--warn-soft); border-color: #f2ddba; color: var(--warn); }
.notice-dim { background: var(--panel-2); border-color: var(--line); color: var(--ink-3); font-size: 11.5px; }

/* 规划列表 / 占位页 */
.plan-list { margin: 0 0 4px; padding-left: 20px; color: var(--ink-2); font-size: 13px; }
.plan-list li { margin-bottom: 5px; }
.prose { font-size: 13px; color: var(--ink-2); line-height: 1.9; }


/* ---------------- 第4章 内力计算 ---------------- */
.sub-head { display: flex; align-items: baseline; gap: 9px; margin: 22px 0 12px; }
.sub-head:first-child { margin-top: 4px; }
.sub-no {
  font-size: 11px; font-weight: 700; color: var(--brand);
  background: var(--brand-soft); border-radius: 4px; padding: 2px 7px; letter-spacing: .3px;
}
.sub-head h3 { font-size: 14px; margin: 0; font-weight: 650; }

.prose-p { font-size: 12.8px; color: var(--ink-2); line-height: 1.85; margin: 0 0 10px; }
.prose-p b { color: var(--ink); font-weight: 650; }

.formula { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 14px; }
.formula .fx {
  flex: 1 1 220px; display: flex; align-items: baseline; gap: 9px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 12px; font-size: 12px; color: var(--ink-3);
}
.formula .fx b { font-size: 13px; color: var(--brand); font-family: "Cambria Math", Georgia, serif; font-weight: 600; }
.formula .fx em { font-style: normal; font-size: 11px; color: var(--ink-3); margin-left: auto; }
.formula .fx.fx-wide { flex: 1 1 100%; }
.formula .fx.fx-wide b { font-size: 13.5px; }
.formula .fx b { white-space: nowrap; }

.tbl-head { display: flex; align-items: baseline; gap: 8px; margin: 16px 0 7px; }
.tbl-no {
  font-size: 11px; font-weight: 700; color: var(--ink-2);
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; background: #fff;
}
.tbl-cap { font-size: 12.3px; color: var(--ink-2); font-weight: 600; }
.tbl-note {
  font-size: 11.6px; color: var(--ink-3); line-height: 1.75;
  margin: 6px 2px 14px; letter-spacing: .1px;
}
.tbl-note b { color: var(--ink-2); font-weight: 650; }

.tw.tw-num td.num {
  text-align: right; font-variant-numeric: tabular-nums;
  color: var(--ink); white-space: nowrap; font-size: 12px;
}
.tw.tw-num td.out {
  text-align: right; font-variant-numeric: tabular-nums;
  color: var(--brand); font-weight: 650; white-space: nowrap; font-size: 12px;
}
.tw.tw-num td.stack {
  text-align: left; font-size: 11.4px; line-height: 1.7; color: var(--ink-2);
  white-space: normal; min-width: 92px;
}
.tw.tw-num td.stack sub { font-size: 9px; }
.tw .c-lab { color: var(--ink-3); font-size: 11.3px; white-space: nowrap; }
.tw .c-lab.lab-head { color: var(--ink-2); font-weight: 600; }
.tw .c-lab.lab-sub { padding-left: 15px; color: var(--ink-3); }

/* 组合表：固定列宽，避免组合式子把首列撑变形 */
.tw.tw-fixed { table-layout: fixed; max-width: 760px; }
.tw.tw-fixed th, .tw.tw-fixed td { white-space: normal; padding: 5px 6px; }
.tw td.c-grp {
  font-size: 11px; line-height: 1.45; color: var(--ink-2);
  font-weight: 600; text-align: center; padding-left: 4px; padding-right: 4px;
}
.tw td.c-grp.c-grp-w { font-size: 10.4px; font-weight: 500; color: var(--ink-3); }
.tw td.c-grp sub { font-size: 9px; }
.tw tr.row-ph > td { border-top: 1px solid var(--line); background: rgba(37,99,235,.028); }
.tw tr.row-sub > td { background: rgba(148,163,184,.06); }
.tw tr.row-sum > td { border-top: 1px solid var(--line-2); background: var(--panel-2); }
.tw .c-sum { color: var(--ink-3); font-size: 11.3px; text-align: left; background: var(--panel-2); }
.tw tr.tr-grp > td { border-top: 1px solid var(--line); }
.tw thead tr:first-child th { border-bottom: 1px solid var(--line-2); }
.tw .t-trans { color: #8a6a3a; font-style: italic; }

.mini-list { display: flex; flex-direction: column; gap: 8px; font-size: 12px; color: var(--ink-3); line-height: 1.7; }
.mini-list b { color: var(--ink-2); font-weight: 600; margin-right: 6px; }

.fig-box .frame-svg { width: 100%; height: auto; display: block; }

/* 真正隐藏但仍可被脚本点击（hidden 属性在个别浏览器里会拒绝弹出文件框） */
.file-input-hidden {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ---------------- 保存面板（模态） ---------------- */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(16, 30, 48, .42);
  animation: maskIn .14s ease;
}
@keyframes maskIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: min(580px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: var(--panel);
  border-radius: 12px;
  box-shadow: 0 24px 60px -20px rgba(16, 30, 48, .45);
  border: 1px solid var(--line);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 18px 13px;
  border-bottom: 1px solid var(--line-2);
}
.modal-head b { font-size: 15px; color: var(--ink); }
.modal-x {
  border: none; background: none; cursor: pointer;
  font-size: 18px; line-height: 1;
  color: var(--ink-3); padding: 2px 4px; border-radius: 6px;
}
.modal-x:hover { background: var(--panel-2); color: var(--ink); }

.modal-body { padding: 16px 18px 4px; }
.modal-lab {
  display: block; font-size: 12px; color: var(--ink-2);
  margin-bottom: 6px; letter-spacing: .2px;
}
.modal-name { display: flex; align-items: center; gap: 8px; }
.modal-name input {
  flex: 1 1 auto; min-width: 0;
  padding: 8px 11px; font-size: 13.5px; font-family: inherit; color: var(--ink);
  background: var(--input-bg);
  border: 1px solid var(--input-line);
  border-radius: 7px; outline: none;
}
.modal-name input:focus { border-color: var(--input-focus); box-shadow: 0 0 0 3px rgba(15, 107, 86, .1); }
.modal-name span { font-size: 13px; color: var(--ink-2); flex: 0 0 auto; }

.modal-tip {
  margin-top: 12px; padding: 10px 12px;
  font-size: 12.5px; line-height: 1.65; color: var(--ink-2);
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px;
}
.modal-tip b { color: var(--ink); }
.modal-tip.warn { background: var(--warn-soft); border-color: #eccf9c; color: #7d4708; }
.modal-tip.ok { background: var(--ok-soft); border-color: #9fd3b8; color: #0e5c3a; }

.modal-acts {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 14px 18px 16px;
  border-top: 1px solid var(--line-2);
  margin-top: 14px;
  background: var(--panel-2);
  border-radius: 0 0 12px 12px;
}
.modal-acts .grow { flex: 1 1 auto; }
.modal-json {
  width: 100%; height: 150px; margin-top: 10px;
  font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; line-height: 1.5;
  color: var(--ink-2); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  resize: vertical; outline: none;
}

/* ---------------- 保存结果提示条 ---------------- */
.toast {
  position: fixed;
  left: 50%;
  top: 18px;
  z-index: 9999;
  transform: translate(-50%, -16px);
  max-width: min(560px, calc(100vw - 40px));
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 8px 28px -10px rgba(16, 30, 48, .35);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-ok { border-color: #9fd3b8; background: var(--ok-soft); color: #0e5c3a; }
.toast-warn { border-color: #eccf9c; background: var(--warn-soft); color: #7d4708; }
.toast-err { border-color: #f0b8b2; background: #fdeceb; color: var(--danger); }

/* 顶栏：另存为是次要动作，窄屏直接隐藏，避免只剩一个空按钮 */
@media (max-width: 720px) {
  #btnSaveAs { display: none; }
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 1080px) {
  .ch1-grid { grid-template-columns: 1fr; }
  .ch1-side { position: static; }
}
@media (max-width: 860px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: static; border-right: none; border-bottom: 1px solid var(--line); }
  .nav { display: flex; gap: 4px; overflow-x: auto; padding: 8px; }
  .nav-item { flex: 0 0 auto; white-space: nowrap; }
  .nav-txt b { display: none; }
  .nav-sep { display: none; }
  .side-foot { display: none; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .fields { grid-template-columns: 1fr; }
  main { padding: 14px; }
  .hero-name { font-size: 20px; }
}

/* 第8章 楼梯荷载表：分项名居中、算式与结果同格 */
.tw.tw-num td.eqname {
  text-align: center; color: var(--ink-2); font-size: 11.9px;
  white-space: normal; line-height: 1.55;
}
.tw.tw-num td.eqval {
  text-align: left; font-variant-numeric: tabular-nums;
  color: var(--ink-3); font-size: 11.9px; white-space: normal; line-height: 1.55;
}
.tw.tw-num td.eqval .eq { letter-spacing: .1px; }
.tw.tw-num td.eqval b { color: var(--ink); font-weight: 650; }
.tw tr.row-sum td.eqval b { color: var(--brand); }

/* ---------------- 表3-1 活荷载规范表（GB 55001-2021 表4.2.2） ---------------- */
.tw.tw-sm { font-size: 11.8px; }
.tw.tw-sm th, .tw.tw-sm td { padding: 4.5px 6px; }
.tw.tw-sm thead th { line-height: 1.3; }
.tw td.td-l { text-align: left; color: var(--ink-2); line-height: 1.5; }
.tw tr.row-on td { background: var(--brand-soft); color: var(--brand); }
.tw tr.row-on td.td-l { color: var(--brand); font-weight: 600; }
.tw tr.row-soft td { background: rgba(15, 107, 86, .045); }
.tw tr.row-soft td.td-l { color: var(--ink-2); font-weight: 600; }
