/* ========== 全局重置 ========== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: "PingFang SC","Microsoft YaHei",sans-serif; background: #F4F6FA; color: #1A2236; font-size: 14px; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }
.hidden { display: none !important; }

/* ========== 顶部导航 ========== */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  position: sticky; top: 0; z-index: 100;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { font-size: 24px; color: #F07818; }
.brand h1 { font-size: 18px; font-weight: 700; color: #1A2236; }
.step-nav { display: flex; gap: 8px; }
.step {
  padding: 6px 14px; border-radius: 999px;
  background: #F4F6FA; color: #6B7280; font-size: 13px;
}
.step.active { background: linear-gradient(135deg, #F07818, #FF9A3D); color: #fff; }
.header-actions button { padding: 6px 14px; }

/* ========== 主区域 ========== */
.app-main { padding: 24px 28px 80px; max-width: 1480px; margin: 0 auto; }
.panel { background: #fff; border-radius: 16px; padding: 22px 28px; box-shadow: 0 2px 14px rgba(0,0,0,0.04); }
.panel + .panel { margin-top: 20px; }
.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 18px;
}
.panel-head h2 { font-size: 18px; font-weight: 700; }
.panel-head h2 small { font-weight: 400; color: #9CA3AF; margin-left: 8px; font-size: 13px; }
.panel-tools { display: flex; gap: 10px; align-items: center; }
.panel-tools input[type="text"] {
  width: 220px; padding: 8px 12px; border: 1px solid #E5E7EB;
  border-radius: 8px; outline: none;
}
.panel-tools input[type="text"]:focus { border-color: #F07818; }

/* ========== 按钮 ========== */
.btn {
  padding: 8px 18px; border-radius: 8px; border: none; font-size: 13px;
  font-weight: 500; transition: all .2s;
}
.btn.primary { background: linear-gradient(135deg, #F07818, #FF9A3D); color: #fff; }
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(240,120,24,0.3); }
.btn.primary:disabled { background: #E5E7EB; color: #9CA3AF; cursor: not-allowed; box-shadow: none; transform: none; }
.btn.ghost { background: #F4F6FA; color: #374151; }
.btn.ghost:hover { background: #E5E7EB; }
.btn.danger { background: #FEE2E2; color: #DC2626; }
.btn.danger:hover { background: #FECACA; }

/* ========== 风格模板网格 ========== */
.template-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.tpl-card {
  border-radius: 12px; overflow: hidden; cursor: pointer;
  border: 2px solid transparent; transition: all .25s;
  background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.tpl-card:hover { transform: translateY(-3px); box-shadow: 0 8px 22px rgba(0,0,0,0.1); }
.tpl-card.selected { border-color: #F07818; box-shadow: 0 6px 20px rgba(240,120,24,0.25); }
.tpl-thumb {
  height: 220px; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.tpl-thumb .thumb-mini {
  width: 75%; height: 90%; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 28px; color: #fff;
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}
.tpl-info { padding: 12px 14px; }
.tpl-info h3 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.tpl-info p { font-size: 12px; color: #6B7280; line-height: 1.4; }
.tpl-info .tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.tpl-info .tag {
  font-size: 10px; padding: 2px 8px; border-radius: 4px;
  background: #FEF3E8; color: #B85C00;
}
.tpl-actions { display: flex; gap: 4px; padding: 0 14px 12px; }
.tpl-actions button { font-size: 11px; padding: 4px 10px; }

/* ========== 文案编辑器 ========== */
.content-editor { display: flex; flex-direction: column; gap: 14px; }
.content-row { display: flex; flex-direction: column; gap: 6px; }
.content-row label { font-weight: 600; font-size: 13px; color: #374151; }
.content-row label small { font-weight: 400; color: #9CA3AF; margin-left: 6px; }
.content-row input, .content-row textarea {
  padding: 10px 14px; border: 1px solid #E5E7EB; border-radius: 8px;
  outline: none; resize: vertical;
}
.content-row input:focus, .content-row textarea:focus { border-color: #F07818; }
.hint {
  font-size: 12px; color: #6B7280; background: #F9FAFB;
  padding: 10px 14px; border-radius: 8px; line-height: 1.7;
}
.hint code { background: #FEF3E8; padding: 1px 6px; border-radius: 4px; color: #B85C00; }

/* ========== 输出区 ========== */
.output-strip {
  display: flex; gap: 12px; overflow-x: auto; padding: 8px 0 16px;
}
.output-strip .strip-item {
  flex-shrink: 0; width: 90px; height: 130px; border-radius: 8px;
  background: #F4F6FA; cursor: pointer; overflow: hidden; position: relative;
  border: 2px solid transparent; transition: all .2s;
}
.output-strip .strip-item.active { border-color: #F07818; }
.output-strip .strip-item .num {
  position: absolute; top: 4px; left: 6px; font-size: 11px;
  color: #fff; background: rgba(0,0,0,0.5); padding: 1px 6px; border-radius: 4px;
}
.output-strip .strip-item .mini-render {
  width: 100%; height: 100%; transform: scale(0.12); transform-origin: top left;
  pointer-events: none; width: 750px; height: 1086px;
}

.output-stage {
  display: flex; justify-content: center; padding: 20px;
  background: linear-gradient(45deg, #F4F6FA 25%, transparent 25%) -10px 0,
              linear-gradient(-45deg, #F4F6FA 25%, transparent 25%) -10px 0,
              linear-gradient(45deg, transparent 75%, #F4F6FA 75%),
              linear-gradient(-45deg, transparent 75%, #F4F6FA 75%);
  background-size: 20px 20px;
  background-color: #FFF;
  min-height: 500px;
}
.stage-wrap {
  position: relative; box-shadow: 0 12px 36px rgba(0,0,0,0.15);
  border-radius: 8px; overflow: hidden;
}

/* ========== 弹窗 ========== */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-mask { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }
.modal-box {
  position: relative; background: #fff; border-radius: 14px;
  width: 520px; max-width: 90vw; max-height: 80vh; overflow: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 22px; border-bottom: 1px solid #E5E7EB;
}
.modal-head h3 { font-size: 16px; font-weight: 700; }
.modal-body { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid #E5E7EB; display: flex; justify-content: flex-end; gap: 10px; }

.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row label { font-size: 12px; font-weight: 600; color: #374151; }
.form-row label small { font-weight: 400; color: #9CA3AF; margin-left: 6px; }
.form-row input, .form-row select {
  padding: 8px 12px; border: 1px solid #E5E7EB; border-radius: 8px; outline: none;
}
.form-row input:focus, .form-row select:focus { border-color: #F07818; }
.color-row { display: flex; gap: 10px; }
.color-row input[type="color"] {
  width: 48px; height: 36px; border: 1px solid #E5E7EB; border-radius: 6px;
  padding: 2px; cursor: pointer; background: #fff;
}
.form-row select[multiple] { min-height: 100px; }