/* ==========================================================================
   PID Designer 网页版 · 计算面板样式
   （图纸编辑器的样式沿用 renderer/style.css，这里只管计算抽屉与加载遮罩）
   ========================================================================== */

#btnCalc { font-weight: 600; }

/* ---------------- 加载遮罩 ---------------- */
#bootMask {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; background: #f6f7f9; color: #1f2430;
  font: 14px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  transition: opacity .35s ease;
}
#bootMask.done { opacity: 0; pointer-events: none; }
#bootMask .bm-title { font-size: 18px; font-weight: 700; letter-spacing: .5px; }
#bootMask .bm-sub { color: #6b7280; }
#bootMask .bm-bar { width: 260px; height: 4px; border-radius: 2px; background: #e3e6ec; overflow: hidden; }
#bootMask .bm-bar i { display: block; height: 100%; width: 30%; border-radius: 2px; background: #1f77ff;
  animation: bmslide 1.1s ease-in-out infinite; }
@keyframes bmslide { 0% { margin-left: -30%; } 100% { margin-left: 100%; } }
#bootMask .bm-err { color: #c0392b; max-width: 520px; text-align: center; white-space: pre-wrap; }

/* ---------------- 计算抽屉 ---------------- */
#calcDrawer {
  position: fixed; top: 46px; right: 0; bottom: 0; width: 520px; max-width: 96vw;  /* top 由 JS 按工具栏实际高度覆盖 */
  background: #ffffff; border-left: 1px solid #dfe3ea;
  box-shadow: -8px 0 28px rgba(16, 24, 40, .10);
  transform: translateX(102%); transition: transform .26s cubic-bezier(.4, 0, .2, 1);
  z-index: 900; display: flex; flex-direction: column;
  font: 13px/1.55 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; color: #1f2430;
}
#calcDrawer.open { transform: translateX(0); }

.calc-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid #e8ebf0; background: #fbfcfe;
}
.calc-title { font-size: 15px; font-weight: 700; }
.calc-x { border: 0; background: transparent; font-size: 20px; line-height: 1; cursor: pointer; color: #6b7280; padding: 0 4px; }
.calc-x:hover { color: #1f2430; }

.calc-tabs { display: flex; gap: 4px; padding: 8px 12px 0; border-bottom: 1px solid #e8ebf0; background: #fbfcfe; }
.calc-tabs button {
  border: 1px solid transparent; border-bottom: 0; background: transparent;
  padding: 7px 12px; border-radius: 7px 7px 0 0; cursor: pointer; font-size: 13px; color: #55607a;
}
.calc-tabs button:hover { background: #eef2f8; }
.calc-tabs button.active { background: #ffffff; border-color: #dfe3ea; color: #1f2430; font-weight: 600; }

.calc-body { flex: 1; overflow: auto; padding: 12px 14px 28px; }
.calc-hint { color: #6b7280; font-size: 12px; margin-bottom: 10px; padding: 6px 8px; background: #f4f6fa; border-radius: 6px; }
.calc-foot { padding: 10px 14px; border-top: 1px solid #e8ebf0; color: #8a93a6; font-size: 11px; background: #fbfcfe; }

.grid1 { display: grid; grid-template-columns: 1fr; gap: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fld { display: flex; flex-direction: column; gap: 3px; }
.fld > span { font-size: 12px; color: #55607a; }
.fld > em { font-size: 11px; color: #9aa3b5; font-style: normal; }
.fld input, .fld select {
  border: 1px solid #d8dde7; border-radius: 6px; padding: 6px 8px; font-size: 13px;
  background: #fff; color: #1f2430; width: 100%; box-sizing: border-box;
}
.fld input:focus, .fld select:focus { outline: 2px solid #cfe0ff; border-color: #7aa7f0; }

.calc-actions { display: flex; gap: 8px; margin: 12px 0 6px; }
.calc-actions button {
  border: 1px solid #d8dde7; background: #fff; border-radius: 7px; padding: 7px 14px;
  cursor: pointer; font-size: 13px; color: #34405a;
}
.calc-actions button:hover { background: #f2f5fa; }
.calc-actions button.primary { background: #1f77ff; border-color: #1f77ff; color: #fff; font-weight: 600; }
.calc-actions button.primary:hover { background: #1a68e0; }
.calc-actions button:disabled { opacity: .55; cursor: default; }

.calc-status { font-size: 12px; min-height: 0; margin: 6px 0; }
.calc-status.running { color: #1f77ff; }
.calc-status.err { color: #c0392b; }

/* ---------------- 结果卡片 ---------------- */
.card { border: 1px solid #e6e9f0; border-radius: 9px; padding: 10px 12px; margin: 10px 0; background: #fff; }
.card h4 { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: #1f2430; }
.card.feas { border-left: 4px solid #cbd2df; }
.card.feas.ok { border-left-color: #1a9e5c; background: #f4fbf7; }
.card.feas.warn { border-left-color: #e0a000; background: #fffbf0; }
.card.feas.bad { border-left-color: #d0392b; background: #fff6f5; }
.card.errcard { border-color: #f0c8c4; background: #fff6f5; }
.card.warncard { border-color: #f2e2bd; background: #fffcf5; }
.card.guidecard { border-color: #cfe0ff; background: #f6faff; }
.card.err-card p { margin: 0; }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border-bottom: 1px dashed #f0f2f6; }
.kv:last-child { border-bottom: 0; }
.kv > span { color: #55607a; }
.kv > b { font-weight: 600; color: #1f2430; text-align: right; }
.kv > b.hl { color: #1f77ff; font-size: 14px; }
.kv > b.bad { color: #d0392b; }
.dim { color: #8a93a6; font-size: 12px; }

.warnlist, .notelist { margin: 0; padding-left: 18px; }
.warnlist li, .notelist li { margin: 3px 0; color: #4b5563; }
.warnlist li { color: #8a6100; }
.notelist li { font-size: 12px; color: #6b7280; }

.tblwrap { overflow-x: auto; margin: 8px 0; border: 1px solid #e6e9f0; border-radius: 9px; }
.tblwrap table { border-collapse: collapse; width: 100%; font-size: 12px; }
.tblwrap th, .tblwrap td { padding: 6px 9px; text-align: left; white-space: nowrap; border-bottom: 1px solid #f0f2f6; }
.tblwrap th { background: #f7f9fc; font-weight: 600; color: #46506a; position: sticky; top: 0; }
.tblwrap tr:last-child td { border-bottom: 0; }
.tblwrap td b { color: #1f77ff; }
.tblwrap td .bad { color: #d0392b; font-weight: 600; }

.calc-cta { display: flex; gap: 8px; margin: 14px 0 4px; }
.calc-cta button {
  border: 1px solid #d8dde7; background: #fff; border-radius: 7px; padding: 8px 14px;
  cursor: pointer; font-size: 13px; color: #34405a;
}
.calc-cta button:hover { background: #f2f5fa; }
.calc-cta button.primary { background: #1f77ff; border-color: #1f77ff; color: #fff; font-weight: 600; }
.calc-cta button.primary:hover { background: #1a68e0; }

/* 网页版没有原生菜单，隐藏桌面版里依赖菜单的按钮 */
body.web #btnCalc { display: inline-block; }

/* 导出菜单挂在 body 上，必须盖过计算抽屉 */
#exportMenu { z-index: 1000 !important; }
#modalRoot, .modal-mask { z-index: 1100 !important; }
#toast { z-index: 1200 !important; }
