/* M20：工具台第七件工具「主图详情生成」。
   骨架复用 tools_cutout.css(.tc-*) / tools_scene.css(.ts-*) / tools_buyer.css(.tb-thumbs)，
   这里只补这个工具独有的：双栏、可编辑规划条目、结果分组。 */

.md-boards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 22px;
}

@media (max-width: 900px) {
  .md-boards { grid-template-columns: 1fr; }
}

.md-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.md-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.md-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  color: #374151;
}

.md-field.is-inline {
  flex: 1 1 120px;
}

.md-field input,
.md-field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  color: #111827;
  background: #fff;
}

.md-field input:focus,
.md-field textarea:focus {
  outline: none;
  border-color: var(--brand-line, #A9EFA4);
  box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.25);
}

.md-req {
  color: #dc2626;
  font-size: 11px;
  font-weight: 600;
}

.md-hintline {
  font-size: 12px;
  color: #9ca3af;
}

.md-seg-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.md-seg-label {
  font-size: 13px;
  color: #374151;
  min-width: 68px;
}

/* ---------- 规划结果（可编辑） ---------- */
.md-plan-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.md-plan-title {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

.md-plan-note {
  font-size: 12px;
  color: #9ca3af;
}

.md-standard {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
}

.md-group-title {
  margin: 14px 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.md-group-title.is-flush {
  margin: 0;
}

.md-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.md-item {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px;
  background: #fff;
}

.md-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12px;
  color: #6b7280;
}

.md-item-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--brand-soft, rgba(113,220,104,.14));
  color: var(--brand-strong, #5BC85A);
  font-weight: 600;
}

.md-item textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font: inherit;
  font-size: 12.5px;
  line-height: 1.55;
  color: #111827;
  resize: vertical;
}

.md-item-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.md-ref-add {
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  padding: 3px 10px;
  cursor: pointer;
}

.md-ref-add:hover {
  border-color: var(--brand-line, #A9EFA4);
  color: var(--brand-strong, #5BC85A);
}

.md-ref-thumbs {
  display: flex;
  gap: 6px;
}

.md-ref-thumb {
  position: relative;
  width: 34px;
  height: 34px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
  background: #f9fafb;
}

.md-ref-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.md-ref-thumb button {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: rgba(17, 24, 39, 0.72);
  color: #fff;
  font-size: 9px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

.md-go-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.md-estimate {
  font-size: 13px;
  color: var(--brand-strong, #5BC85A);
  font-weight: 600;
}

/* ---------- 结果区 ---------- */
.md-result-head {
  display: flex;
  gap: 18px;
  margin-bottom: 8px;
}

.md-result-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.md-card {
  position: relative;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  background: #f9fafb;
}

.md-card.is-picked {
  border-color: var(--brand-strong, #5BC85A);
  box-shadow: 0 0 0 2px rgba(113,220,104,0.2);
}

.md-card img {
  width: 100%;
  display: block;
  cursor: zoom-in;
}

.md-card-top {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  font-size: 12px;
  color: #6b7280;
}

.md-card-ops {
  position: absolute;
  right: 6px;
  top: 6px;
  display: none;
  gap: 4px;
}

.md-card:hover .md-card-ops {
  display: flex;
}

.md-card-ops button {
  border: 0;
  border-radius: 6px;
  background: rgba(17, 24, 39, 0.78);
  color: #fff;
  font-size: 11px;
  padding: 3px 8px;
  cursor: pointer;
}

.md-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

/* ---------- M22：产品图（自动带上）/ 任务卡结果图尺寸 ---------- */

/* 自动带上的那张产品图：蓝框 + 左下角锁标，跟用户自己补的参考图区分开 */
.md-ref-thumb.is-auto {
  border-color: var(--brand-strong, #5BC85A);
}

.md-ref-thumb .md-ref-lock {
  position: absolute;
  left: 1px;
  bottom: 1px;
  font-size: 10px;
  line-height: 1;
  pointer-events: none;
}

.md-ref-note {
  font-size: 11px;
  color: #6b7280;
}

/* 任务卡里的结果图：照另外 6 个工具的 .tc-img-box，但要盖掉 tools_queue.css 的
   `.ts-task-grid .tc-img-box img { max-height: none; width: 100% }`（本文件在它之前加载，
   所以这里用 #mdTasks 提高优先级）—— 2K 原图不许再把卡片撑爆。 */
#mdTasks .ts-task-grid .tc-img-box img {
  max-height: 300px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

#mdTasks .ts-task-grid .tc-img-box {
  min-height: 0;
}

/* 结果区悬停操作里的「下载」是个 <a>，跟按钮同一套观感 */
.md-card-ops a {
  border: 0;
  border-radius: 6px;
  background: rgba(17, 24, 39, 0.78);
  color: #fff;
  font-size: 11px;
  padding: 3px 8px;
  cursor: pointer;
  text-decoration: none;
}

/* M27-C：三段式版式（左输入 + 中规划/任务 + 右结果），照 .rf-layout 写法搬。
   红线：不动现有 .md-boards 基础定义（三个页面共用），只追加新规则；不套精修 .rf-layout。
   specificity 用 .md-three-col 限定，不影响其他页面（不主动加 .md-three-col 时不生效）。 */
.md-three-col {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 190px;
  gap: 14px;
  align-items: start;
  margin-top: 22px;
}
.md-three-col .md-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.md-three-col .md-left .md-boards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.md-three-col .md-left .tc-drop {
  min-height: 96px;
  max-height: 120px;
  padding: 8px 10px;
  gap: 4px;
  overflow: hidden;
}
.md-three-col .md-left .tc-drop-icon { font-size: 1.2rem; }
.md-three-col .md-left .tc-drop-title { font-size: 13px; line-height: 1.3; }
.md-three-col .md-left .tc-drop-hint { font-size: 11px; line-height: 1.45; }
.md-three-col .md-left .tc-preview { max-height: 90px; margin-bottom: 4px; }
.md-three-col .md-left .tc-go {
  position: sticky;
  bottom: 8px;
  z-index: 1;
  box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.06);
}
.md-three-col .md-mid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.md-three-col .md-side { min-width: 0; }
@media (max-width: 1200px) {
  .md-three-col { grid-template-columns: 300px minmax(0, 1fr); }
  .md-three-col .md-side { display: none; } /* 收两列时右栏折叠（结果去中列底部） */
}
@media (max-width: 900px) {
  .md-three-col { grid-template-columns: 1fr; }
  .md-three-col .md-left .tc-drop { max-height: 200px; }
  .md-three-col .md-left .tc-go { position: static; box-shadow: none; }
}

/* M28-补1：三步向导的三栏网格必须挂在 .md-step-pane 这一层（它才是三栏的父容器）。
   红线：不动现有 .md-three-col 规则（电商详情页 /tools/detail 还在吃它）。
   .md-wizard 是主图详情 /tools/main-detail 专属 wrapper：外层不再当网格用，
   让每个步骤面板（.md-step-pane）自己当 grid 容器，grid-template-columns 三段式 300/自适应/190。
   ⚠️ 关键 [hidden] 坑：作者 display:grid 会盖掉 UA 默认 [hidden]{display:none}，
   不写 .md-step-pane[hidden] { display:none } 就会三步同时显示。 */
.md-wizard { display: block; }                /* 外层不再当 grid 用 */
.md-wizard > .md-step-pane {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 190px;
  gap: 14px;
  align-items: start;
}
.md-wizard > .md-step-pane[hidden] { display: none; }   /* ⚠️ 见上注释，必须写 */
@media (max-width: 1200px) {
  .md-wizard > .md-step-pane { grid-template-columns: 300px minmax(0, 1fr); }
  .md-wizard > .md-step-pane .md-side { display: none; }
}
@media (max-width: 900px) {
  .md-wizard > .md-step-pane { grid-template-columns: 1fr; }
}
