/* ==================================================================
   社群人脉 · 生活工具频道（独立模块 window.Tools）
   风格：微信小程序卡片式 —— 浅色渐变背景 + 主题白卡 + 分段胶囊按钮
   约定：计算器根节点 .tool-calc 上通过 inline style 注入 --tc(主题色)/--tbg(浅底)
   ================================================================== */

/* 整页（无底栏） */
.tools-page { min-height: 100vh; background: #f4f5f8; }
.tool-page { min-height: 100vh; background: linear-gradient(180deg, var(--tbg, #eef1f6) 0%, #f4f5f8 220px); }

/* ---------------- 工具集首页 ---------------- */
.tool-hub-head {
  padding: 22px 18px 14px;
  background: linear-gradient(135deg, #6b5bf5 0%, #8a5bf5 100%);
  color: #fff;
}
.tool-hub-head h1 { font-size: 21px; font-weight: 700; margin: 0; letter-spacing: .5px; }
.tool-hub-head p { margin: 6px 0 0; font-size: 13px; opacity: .9; }
.tool-hub-head .tool-hub-ic { float: right; width: 44px; height: 44px; border-radius: 12px; background: rgba(255,255,255,.18);
  display: flex; align-items: center; justify-content: center; }

.tool-hub-body { padding: 14px 12px 30px; }
.tool-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tool-card {
  position: relative; background: #fff; border-radius: 14px; padding: 14px 13px 13px;
  box-shadow: 0 4px 14px rgba(40,40,80,.06); display: flex; flex-direction: column; gap: 7px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.tool-card:active { transform: translateY(1px); box-shadow: 0 2px 8px rgba(40,40,80,.08); }
.tool-card .tool-ic {
  width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center;
}
.tool-card .tool-name { font-size: 15px; font-weight: 700; color: #1f2430; }
.tool-card .tool-desc { font-size: 11.5px; color: #8a90a4; line-height: 1.45; min-height: 32px; }
.tool-card .tool-tag {
  align-self: flex-start; font-size: 10.5px; padding: 2px 8px; border-radius: 20px; color: #fff; opacity: .92;
}

/* ---------------- 计算器页 ---------------- */
.tool-calc-head {
  position: relative; padding: 18px 16px 16px; color: #fff;
  background: linear-gradient(135deg, var(--tc, #6b5bf5) 0%, color-mix(in srgb, var(--tc, #6b5bf5) 70%, #ffffff) 140%);
}
.tool-calc-head .tool-back {
  position: absolute; left: 12px; top: 16px; width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.tool-calc-head h1 { font-size: 19px; font-weight: 700; margin: 0 0 0 30px; }
.tool-calc-head p { margin: 6px 0 0 30px; font-size: 12.5px; opacity: .92; }

.tool-calc-body { padding: 14px 12px 120px; }
.tool-card-box {
  background: #fff; border-radius: 16px; padding: 16px 15px; margin: 0 0 14px;
  box-shadow: 0 6px 18px rgba(40,40,80,.06);
}
.tool-card-box .tool-box-cap {
  display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: #1f2430; margin-bottom: 12px;
}
.tool-card-box .tool-box-cap .tci {
  width: 24px; height: 24px; border-radius: 7px; background: var(--tbg, #eef1f6); color: var(--tc, #6b5bf5);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800;
}

/* 字段 */
.tool-field { margin-bottom: 14px; }
.tool-field:last-child { margin-bottom: 4px; }
.tool-field > label { display: block; font-size: 13px; color: #5a6072; margin-bottom: 7px; font-weight: 600; }
.tool-seg { display: flex; flex-wrap: wrap; gap: 8px; }
.tool-seg button {
  flex: 1 1 auto; min-width: 64px; padding: 9px 6px; border-radius: 10px; font-size: 13px; cursor: pointer;
  background: var(--tbg, #eef1f6); color: var(--tc, #6b5bf5); border: 1px solid transparent; font-weight: 600;
  transition: all .12s ease;
}
.tool-seg button.on { background: var(--tc, #6b5bf5); color: #fff; border-color: var(--tc, #6b5bf5); }
.tool-seg.cols2 button { flex: 1 1 40%; }
.tool-seg.cols3 button { flex: 1 1 28%; }
.tool-seg.cols5 button { flex: 1 1 17%; min-width: 52px; }

.tool-input-wrap { position: relative; display: flex; align-items: center; }
.tool-input-wrap input {
  width: 100%; box-sizing: border-box; padding: 12px 52px 12px 14px; font-size: 15px; border-radius: 11px;
  border: 1px solid #e4e7ef; background: #fafbfd; color: #1f2430; outline: none; transition: border-color .12s;
}
.tool-input-wrap input:focus { border-color: var(--tc, #6b5bf5); }
.tool-input-wrap .tunit {
  position: absolute; right: 14px; font-size: 12px; color: #9aa0b2; pointer-events: none;
}
.tool-quick { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.tool-quick button {
  padding: 5px 11px; border-radius: 16px; font-size: 12px; cursor: pointer;
  background: var(--tbg, #eef1f6); color: var(--tc, #6b5bf5); border: 1px solid transparent;
}
.tool-quick button:active { background: var(--tc, #6b5bf5); color: #fff; }

/* 行输入（AA 分摊） */
.tool-rows { display: flex; flex-direction: column; gap: 9px; }
.tool-row { display: flex; gap: 8px; align-items: center; }
.tool-row input {
  box-sizing: border-box; padding: 10px 12px; font-size: 14px; border-radius: 10px; border: 1px solid #e4e7ef;
  background: #fafbfd; outline: none;
}
.tool-row input.r-name { flex: 1 1 auto; }
.tool-row input.r-amt { width: 92px; }
.tool-row .r-del {
  flex: 0 0 30px; height: 30px; border-radius: 8px; border: none; background: #fdecec; color: #e2606a;
  font-size: 16px; cursor: pointer; line-height: 1;
}
.tool-add {
  margin-top: 4px; padding: 9px; border-radius: 10px; border: 1px dashed var(--tc, #6b5bf5); background: transparent;
  color: var(--tc, #6b5bf5); font-size: 13px; font-weight: 600; cursor: pointer; width: 100%;
}

/* 立即计算 */
.tool-calc-btn {
  position: fixed; left: 12px; right: 12px; bottom: 16px; max-width: 480px; margin: 0 auto;
  height: 50px; border: none; border-radius: 25px; background: var(--tc, #6b5bf5); color: #fff;
  font-size: 16px; font-weight: 700; cursor: pointer; box-shadow: 0 8px 20px rgba(107,91,245,.32);
}
.tool-calc-btn:active { transform: translateY(1px); }

/* 结果 */
.tool-result { display: none; background: #fff; border-radius: 16px; padding: 4px 15px 16px; margin-top: 2px;
  box-shadow: 0 6px 18px rgba(40,40,80,.06); }
.tool-result.show { display: block; animation: toolPop .22s ease; }
@keyframes toolPop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.tool-summary {
  margin: 12px -15px 14px; padding: 16px 15px; color: #fff;
  background: linear-gradient(135deg, var(--tc, #6b5bf5), color-mix(in srgb, var(--tc, #6b5bf5) 72%, #fff));
}
.tool-summary .ts-label { font-size: 13px; opacity: .92; }
.tool-summary .ts-value { font-size: 27px; font-weight: 800; margin-top: 3px; letter-spacing: .5px; }
.tool-summary .ts-sub { font-size: 12px; opacity: .9; margin-top: 3px; }

.tool-rows-out { border-top: 1px solid #f0f1f5; }
.tool-rows-out .tr {
  display: flex; justify-content: space-between; align-items: center; padding: 11px 2px; border-bottom: 1px solid #f4f5f8;
  font-size: 14px;
}
.tool-rows-out .tr .tl { color: #6a7082; }
.tool-rows-out .tr .tv { color: #1f2430; font-weight: 700; }
.tool-rows-out .tr.hl .tv { color: var(--tc, #6b5bf5); font-size: 15.5px; }
.tool-notes { margin-top: 12px; padding: 10px 12px; background: #f7f8fb; border-radius: 10px;
  font-size: 11.5px; color: #8a90a4; line-height: 1.6; }
.tool-details { margin-top: 12px; }
.tool-details table { width: 100%; border-collapse: collapse; font-size: 12px; }
.tool-details th, .tool-details td { border: 1px solid #eef0f5; padding: 6px 8px; text-align: center; color: #5a6072; }
.tool-details th { background: #f7f8fb; color: #6a7082; font-weight: 600; }

/* 空态 */
.tool-empty { text-align: center; color: #9aa0b2; padding: 40px 0; font-size: 14px; }
