/* ===========================================================
   在线制作 · 四步构建器
   =========================================================== */

.builder { background: linear-gradient(180deg, #FFF7F1 0%, #FFFDFB 260px); min-height: 100vh; }

/* 步骤条 */
.wizard {
    position: sticky; top: 68px; z-index: 40;
    background: rgba(255, 255, 255, .9); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}
.wizard-inner { display: flex; align-items: center; gap: 6px; padding: 14px 0; flex-wrap: wrap; }
.wstep {
    display: flex; align-items: center; gap: 9px; padding: 7px 16px 7px 8px;
    border-radius: 999px; cursor: pointer; transition: .2s; font-size: 14px; color: var(--muted);
}
.wstep i {
    width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
    background: #F1E9E3; color: var(--muted); font-style: normal; font-size: 13px; font-weight: 700;
    transition: .2s;
}
.wstep.active { color: var(--brand-dark); background: var(--brand-soft); font-weight: 600; }
.wstep.active i { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }
.wstep.done i { background: var(--success); color: #fff; }
.wstep-arrow { color: var(--line-2); font-size: 12px; }
.wizard-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* 主布局 */
.builder-layout {
    display: grid; grid-template-columns: minmax(420px, 500px) 1fr;
    gap: 26px; align-items: start; padding: 24px 0 60px;
}
.panel {
    background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm); overflow: hidden;
}
.panel-head { padding: 18px 22px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #FFF9F4, #fff); }
.panel-head h3 { font-size: 16.5px; }
.panel-head p { font-size: 13px; color: var(--muted); margin-top: 3px; }
.panel-body { padding: 20px 22px; max-height: calc(100vh - 260px); overflow-y: auto; }
.panel-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; background: #FFFDFB; }
.panel-foot .btn { flex: 1; }

/* 预览 */
.preview-stage {
    position: sticky; top: 148px;
    background: #F4EDE7; border: 1px solid var(--line); border-radius: var(--r-lg);
    padding: 22px; display: flex; justify-content: center; overflow: hidden;
    background-image: linear-gradient(45deg, #F7F1EC 25%, transparent 25%),
                      linear-gradient(-45deg, #F7F1EC 25%, transparent 25%);
    background-size: 22px 22px;
}
.preview-paper { transform-origin: top center; box-shadow: 0 18px 44px rgba(56, 33, 15, .18); background: #fff; }
.preview-loading { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; color: var(--muted); }

/* 模板选择网格（步骤 1） */
.mini-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.mini {
    border: 2px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer;
    position: relative; transition: .2s; background: #fff;
}
.mini:hover { border-color: var(--brand-line); transform: translateY(-3px); }
.mini.active { border-color: var(--brand); box-shadow: 0 8px 20px rgba(255, 122, 47, .22); }
.mini-thumb { height: 158px; overflow: hidden; position: relative; }
.mini-thumb .tpl-scale { transform: scale(.17); }
.mini-thumb .tpl-scale-box { width: 135px; height: 158px; margin: 0 auto; }
.mini-name { font-size: 12.5px; padding: 7px 8px; text-align: center; font-weight: 600; }
.mini.active .mini-name { color: var(--brand-dark); }
.mini-check {
    position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; border-radius: 50%;
    background: var(--brand); color: #fff; font-size: 12px; display: none; place-items: center; z-index: 3;
}
.mini.active .mini-check { display: grid; }

/* 表单模块 */
.mod { border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 14px; background: #FFFDFB; }
.mod-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.mod-title { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 7px; }
.mod-title span { font-size: 16px; }
.ico-btn {
    border: 1px solid var(--line-2); background: #fff; border-radius: 8px; width: 28px; height: 28px;
    cursor: pointer; color: var(--muted); font-size: 15px; line-height: 1; transition: .18s;
}
.ico-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.f { margin-bottom: 12px; }
.f label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.f input, .f textarea, .f select {
    width: 100%; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 9px;
    font-size: 13.5px; font-family: inherit; color: var(--ink); background: #fff; transition: .18s;
}
.f input:focus, .f textarea:focus, .f select:focus {
    outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(255, 122, 47, .13);
}
.f textarea { min-height: 74px; resize: vertical; line-height: 1.7; }
.entry { border: 1px dashed var(--line-2); border-radius: 12px; padding: 14px; margin-bottom: 12px; position: relative; background: #fff; }
.entry .del { position: absolute; top: 8px; right: 8px; }
.entry-title { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }

/* 标签选择 */
.tag-pool { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.tag {
    font-size: 12.5px; padding: 5px 12px; border-radius: 999px; cursor: pointer;
    border: 1px solid var(--line-2); background: #fff; color: var(--ink-2); transition: .16s; user-select: none;
}
.tag:hover { border-color: var(--brand); color: var(--brand-dark); }
.tag.on { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-color: transparent; }
.tag-remove { cursor: pointer; }
.skill-pool { display: flex; flex-wrap: wrap; gap: 7px; }
.skill-pool .tag::after { content: " ×"; opacity: .6; }

.ai-tip {
    font-size: 12px; color: var(--brand-dark); background: var(--brand-soft);
    border: 1px dashed var(--brand-line); border-radius: 9px; padding: 8px 11px; margin-bottom: 10px;
}
.ai-btn-inline {
    border: none; background: var(--brand-soft); color: var(--brand-dark); font-size: 12px;
    padding: 4px 10px; border-radius: 999px; cursor: pointer; font-weight: 600; margin-top: 6px;
}
.ai-btn-inline:hover { background: #FFE7D6; }

/* 证件照工作台 */
.photo-work { display: grid; grid-template-columns: 1fr 168px; gap: 18px; }
.photo-canvas-box {
    background: #F7F3EF; border: 1px dashed var(--line-2); border-radius: 12px;
    min-height: 220px; display: grid; place-items: center; padding: 12px; text-align: center;
}
.photo-canvas-box canvas { max-width: 100%; border-radius: 6px; box-shadow: var(--shadow-sm); }
.photo-side { display: flex; flex-direction: column; gap: 10px; }
.swatches { display: flex; gap: 8px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; cursor: pointer; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line-2); }
.swatch.on { box-shadow: 0 0 0 2px var(--brand); }
.upload-zone {
    border: 2px dashed var(--brand-line); border-radius: 14px; padding: 28px 16px; text-align: center;
    cursor: pointer; background: var(--brand-softer); transition: .2s;
}
.upload-zone:hover { background: #FFEFE2; }
.upload-zone b { display: block; font-size: 14.5px; margin-bottom: 4px; }

/* 结果卡片（AI） */
.ai-result {
    border: 1px solid var(--brand-line); background: linear-gradient(160deg, #FFF8F2, #fff);
    border-radius: var(--r); padding: 16px; font-size: 14px; line-height: 1.9; white-space: pre-wrap;
}
.ver-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; cursor: pointer; transition: .18s; }
.ver-item:hover { border-color: var(--brand); }
.ver-item.on { border-color: var(--brand); background: var(--brand-softer); }
.ver-label { font-size: 12px; color: var(--brand-dark); font-weight: 700; margin-bottom: 5px; }
.ver-text { font-size: 13.2px; color: var(--ink-2); line-height: 1.85; }

/* 保存状态 */
.save-state { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.dot.saving { background: var(--brand); }

@media (max-width: 1100px) {
    .builder-layout { grid-template-columns: 1fr; }
    .preview-stage { position: relative; top: 0; }
    .panel-body { max-height: none; }
}
@media (max-width: 720px) {
    .mini-grid { grid-template-columns: repeat(2, 1fr); }
    .row, .row-3 { grid-template-columns: 1fr; }
    .photo-work { grid-template-columns: 1fr; }
    .wizard-inner { gap: 2px; }
    .wstep { padding: 6px 10px; font-size: 13px; }
    .wstep-arrow { display: none; }
}
