/* ── 抽屉 ─────────────────────────────────────────────── */
.scrim {
  position: fixed; inset: 0; z-index: 50; background: rgba(8,12,13,.34);
  opacity: 0; pointer-events: none; transition: opacity 200ms;
}
.scrim.is-open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  max-height: 88vh; display: flex; flex-direction: column;
  background: var(--sheet-bg); border-radius: 16px 16px 0 0;
  transform: translateY(100%); transition: transform 260ms cubic-bezier(.32,.72,0,1);
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet.is-open { transform: translateY(0); }
.sheet-grip { width: 34px; height: 4px; border-radius: 2px; background: var(--ink-4); margin: 8px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px 10px; flex: none; }
.sheet-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.sheet-head .top-btn { margin-left: auto; }
.sheet-body { overflow-y: auto; padding: 0 16px 20px; -webkit-overflow-scrolling: touch; }
.sheet-inner { max-width: 480px; margin: 0 auto; }
@media (min-width: 720px) { .sheet-inner { max-width: 560px; } }

/* ── 对比表 ───────────────────────────────────────────── */
.cmp-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -16px; padding: 0 16px; }
.cmp { width: 100%; min-width: 300px; border-collapse: collapse; }
.cmp th, .cmp td {
  padding: 9px 6px; text-align: right; font-size: 13px;
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum";
  border-bottom: 1px solid var(--line-2); white-space: nowrap;
}
.cmp th:first-child, .cmp td:first-child {
  text-align: left; color: var(--ink-3); font-size: 12px; font-weight: 400; padding-left: 0;
}
.cmp thead th {
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  border-bottom-color: var(--line); padding-bottom: 8px;
  max-width: 5.6em; overflow: hidden; text-overflow: ellipsis;
}
.cmp thead th.is-on { color: var(--ink); }
.cmp td.is-on { background: var(--tint); }
.cmp td.best { font-weight: 600; }
.cmp tfoot td { border-bottom: 0; padding-top: 12px; }
.cmp-pick {
  width: 100%; height: 30px; border-radius: 8px; font-size: 12.5px; font-weight: 600;
  background: var(--sunk); color: var(--ink-2);
}
.cmp-pick.is-on { background: var(--accent); color: var(--on-accent); }
.cmp-foot { margin: 14px 0 0; font-size: 12px; line-height: 1.6; color: var(--ink-3); }

/* ── 项目抽屉 ─────────────────────────────────────────── */
.meta-field { border-top: 1px solid var(--line-2); padding: 10px 0; display: block; }
.meta-field:first-child { border-top: 0; padding-top: 0; }
.meta-field span { display: block; font-size: 11.5px; color: var(--ink-3); margin-bottom: 2px; }
.meta-field input { width: 100%; border: 0; background: none; padding: 2px 0; font-size: 14px; }
.meta-field input:focus { outline: none; }
.meta-field input:disabled { -webkit-text-fill-color: var(--ink-2); opacity: 1; }

.sheet-actions { display: flex; gap: 8px; margin-top: 16px; }
.btn {
  flex: 1; min-height: 40px; padding: 0 12px; border-radius: 10px; background: var(--sunk);
  font-size: 13.5px; font-weight: 500; color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background 150ms; white-space: nowrap;
}
.btn:active { background: var(--line-2); }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:active { opacity: .8; background: var(--accent); }
.btn[disabled] { opacity: .5; }

.lib-sec { margin-top: 18px; }
.lib-sec > .group-head { padding-left: 0; padding-right: 0; }
.lib-list { display: grid; gap: 6px; }
.lib-row { display: flex; align-items: center; gap: 4px; }
.lib-item {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 10px; background: var(--sunk); text-align: left;
}
.lib-item.is-on { background: var(--tint); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 26%, transparent); }
.lib-main { flex: 1; min-width: 0; display: grid; gap: 1px; }
.lib-main b { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-main > i { font-style: normal; font-size: 11.5px; color: var(--ink-3); }
.lib-val {
  font-size: 12px; font-weight: 600; margin-top: 2px;
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum";
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lib-val i { font-style: normal; color: var(--ink-3); font-weight: 400; }
.lib-tool {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  display: grid; place-items: center; color: var(--ink-3);
}
.lib-tool:active { background: var(--line-2); }
.lib-tool.danger:active { color: var(--danger); }
.empty-note { margin: 6px 0; font-size: 12.5px; color: var(--ink-3); }

.session-row {
  display: flex; align-items: center; gap: 8px;
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-2);
  font-size: 13px; color: var(--ink-2);
}
.avatar {
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 12px; font-weight: 600;
  background: var(--tint); color: var(--accent);
}
.session-row button { margin-left: auto; font-size: 13px; color: var(--ink-3); padding: 6px 10px; border-radius: 8px; }
.session-row button:active { background: var(--line-2); }

/* ── 弹窗 ─────────────────────────────────────────────── */
dialog {
  width: min(360px, calc(100vw - 32px)); padding: 0; border: 0;
  border-radius: 16px; background: var(--sheet-bg); color: var(--ink);
  box-shadow: var(--shadow-3);
}
dialog::backdrop { background: rgba(8,12,13,.34); }
.dialog-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 6px; }
.dialog-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.dialog-head .top-btn { margin-left: auto; }
.dialog-body { padding: 6px 16px 4px; max-height: 56vh; overflow-y: auto; }
.dialog-actions { display: flex; gap: 8px; padding: 8px 16px 16px; }
.share-help { margin: 0 0 10px; font-size: 12.5px; color: var(--ink-3); line-height: 1.6; }
.people-list { display: grid; gap: 2px; }
.person {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 9px; transition: background 150ms;
}
.person:active { background: var(--sunk); }
.person input { width: 18px; height: 18px; flex: none; accent-color: var(--accent); }
.person b { font-size: 14px; font-weight: 500; }
.person i { font-style: normal; font-size: 11.5px; color: var(--ink-3); margin-left: 6px; }

.toast {
  position: fixed; left: 50%; bottom: calc(78px + env(safe-area-inset-bottom));
  transform: translate(-50%, 8px); z-index: 80;
  padding: 9px 14px; border-radius: 10px;
  background: var(--ink); color: var(--bg); font-size: 13px;
  opacity: 0; pointer-events: none; transition: opacity 200ms, transform 200ms;
  max-width: calc(100vw - 32px); text-align: center;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* 两个工作区共用底部导航；测算结论停在导航或键盘上方。 */
:root { --app-tabs-height: calc(60px + env(safe-area-inset-bottom)); }
body { padding-bottom: calc(76px + var(--app-tabs-height)); }
.app-tabs {
  position: fixed; inset: auto 0 0; z-index: 45;
  height: var(--app-tabs-height); padding-bottom: env(safe-area-inset-bottom);
  display: flex; justify-content: center;
  background: var(--surface); box-shadow: var(--shadow-2);
}
.app-tabs button {
  flex: 1; max-width: 280px; display: grid; align-content: center; gap: 1px;
  color: var(--ink-3); font-size: 14px; transition: color 150ms, background 150ms;
}
.app-tabs button span { font-size: 11.5px; font-weight: 400; }
.app-tabs button[aria-selected="true"] { color: var(--accent); background: var(--tint); font-weight: 600; }
.dock { bottom: max(var(--app-tabs-height), var(--keyboard-gap, 0px)); padding-bottom: 9px; }
.dock:not(.is-up) { visibility: hidden; }
.toast { bottom: calc(76px + var(--app-tabs-height)); }
.reno-panel .topbar { height: auto; min-height: 56px; flex-wrap: wrap; }
.reno-panel .topbar-title { display: grid; gap: 0; }
.reno-panel .topbar-title b { white-space: normal; overflow-wrap: anywhere; }
.reno-panel .lib-list, .reno-content { padding: 0 16px 16px; }
.reno-panel .lib-main b { white-space: normal; overflow-wrap: anywhere; }
.reno-panel .lib-item { min-height: 60px; }
.reno-panel .btn, #reno-sheet .btn, .reno-choices .btn { min-height: 44px; }
.reno-panel .lib-tool { width: 44px; height: 44px; }
.reno-panel .empty-note { padding: 12px 0; line-height: 1.7; }
.reno-content h2 { margin: 0 0 8px; font-size: 15px; font-weight: 600; }
.reno-content { padding-top: 16px; overflow-wrap: anywhere; }
.reno-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.btn.danger { color: var(--danger); }
.reno-choices { flex-direction: column; }
.reno-version { background: var(--sunk); border-radius: 8px; padding: 12px; margin: 8px 0; overflow-wrap: anywhere; }
.reno-version b { display: block; font-weight: 500; }
.reno-version span { color: var(--ink-2); font-size: 12px; }
.gate-field select {
  width: 100%; height: 44px; min-width: 0; padding: 0 10px;
  border: 0; border-radius: 10px; background: var(--sunk); color: var(--ink); font: inherit;
}
#reno-sheet .sheet-body { padding-bottom: 24px; }
.reno-loading { margin: 12px 16px; height: 60px; border-radius: 8px; background: var(--sunk); }
