/* ============================================================
   MaterialCalc 统一计算器引擎样式(tool-calc.js 动态生成)
   依赖 main.css 设计令牌与 tool.css 已有卡片样式
   ============================================================ */

/* ---------- 卡片头部操作区 ---------- */
.card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.card-actions .tag {
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--brand-soft);
  color: var(--brand);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.seg {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--bg);
  padding: 2px;
  gap: 2px;
}
.seg-btn {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-soft);
  padding: 4px 11px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease;
}
.seg-btn small {
  display: block;
  font-size: 0.6rem;
  font-weight: 650;
  opacity: 0.75;
  text-align: center;
}
.seg-btn:hover {
  color: var(--text);
}
.seg-btn.active {
  background: var(--brand);
  color: #fff;
}
.seg-btn.active:hover {
  color: #fff;
}

/* ---------- 区域卡片(多房间/多区域) ---------- */
.tc-region {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--card-bg);
  padding: 14px 16px 4px;
  margin-bottom: 14px;
}
.tc-region.first {
  background: #fff;
}
.tc-reg-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.tc-reg-title {
  font-weight: 750;
  font-size: 0.95rem;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-right: 4px;
}
.tc-reg-title .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--brand);
  flex: none;
}
.tc-mini-select {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-soft);
  padding: 5px 26px 5px 10px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234c5f56' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.tc-reg-del {
  margin-left: auto;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--muted);
  font: inherit;
  font-size: 0.74rem;
  font-weight: 650;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.tc-reg-del:hover {
  color: #b3362b;
  border-color: #f0b9b3;
}
.tc-reg-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 16px;
}
.tc-field.full {
  grid-column: 1 / -1;
}

/* 英尺+英寸 组合输入 */
.tc-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.tc-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 6px;
}
.tc-field {
  margin-bottom: 12px;
  min-width: 0;
}
.tc-field .field-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 6px;
}
.tc-field .field-label .tc-unit {
  font-weight: 600;
  color: var(--muted);
}

/* ---------- 添加 / 全局设置 ---------- */
.tc-add-wrap {
  margin: 2px 0 6px;
}
.tc-add {
  width: 100%;
  border: 1.5px dashed var(--line-strong);
  background: #fff;
  color: var(--brand);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 11px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.tc-add:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.tc-sep {
  border: 0;
  border-top: 1px dashed var(--line-strong);
  margin: 16px 0 14px;
}
.tc-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 750;
  color: var(--text);
  margin: 2px 0 10px;
}
.tc-group-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.tc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 16px;
}
.tc-grid .full {
  grid-column: 1 / -1;
}

/* ---------- 结果区微调 ---------- */
.tc-result { margin-top: 18px; }
.r-sub {
  border-top: 1px dashed var(--line-strong);
  margin-top: 10px;
  padding-top: 6px;
}
.tc-region-rows-title {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 12px 20px 0;
}
.tc-total-row dt,
.tc-total-row dd {
  font-weight: 800;
  color: var(--text);
}

/* ---------- 响应式 ---------- */
@media (max-width: 560px) {
  .tc-reg-body,
  .tc-grid {
    grid-template-columns: 1fr;
  }
  .tc-reg-body .full,
  .tc-grid .full {
    grid-column: auto;
  }
}
