* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: "PingFang SC", "Microsoft YaHei", sans-serif; background: #f0f2f5; color: #333; font-size: 14px; }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1f3a5f, #2c5f8a); }
.login-card { background: #fff; border-radius: 12px; padding: 40px; width: 360px; box-shadow: 0 10px 40px rgba(0,0,0,.15); }
.login-card h1 { font-size: 20px; text-align: center; margin-bottom: 28px; color: #1f3a5f; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 200px; background: #001529; color: #fff; flex-shrink: 0; }
.sidebar .logo { padding: 20px 16px; font-size: 16px; font-weight: 600; color: #fff; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar .menu-item { display: block; padding: 14px 20px; color: rgba(255,255,255,.65); cursor: pointer; text-decoration: none; }
.sidebar .menu-item:hover { color: #fff; }
.sidebar .menu-item.active { color: #fff; background: #1890ff; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { background: #fff; padding: 0 24px; height: 56px; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.content { padding: 24px; flex: 1; }
.page-title { font-size: 18px; font-weight: 600; margin-bottom: 20px; }

/* ---------- 通用组件 ---------- */
.card { background: #fff; border-radius: 8px; padding: 20px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.btn { display: inline-block; padding: 7px 16px; border: 1px solid #d9d9d9; background: #fff; border-radius: 4px; cursor: pointer; font-size: 13px; color: #333; }
.btn:hover { border-color: #1890ff; color: #1890ff; }
.btn.primary { background: #1890ff; border-color: #1890ff; color: #fff; }
.btn.primary:hover { background: #40a9ff; }
.btn.danger { color: #ff4d4f; border-color: #ffccc7; }
.btn.danger:hover { border-color: #ff4d4f; }
.btn.small { padding: 3px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.input, select.input { padding: 7px 10px; border: 1px solid #d9d9d9; border-radius: 4px; font-size: 13px; outline: none; min-width: 160px; }
.input:focus { border-color: #1890ff; }
.input.full { width: 100%; }
.form-row { display: flex; align-items: center; margin-bottom: 14px; gap: 10px; }
.form-row label { width: 90px; text-align: right; color: #666; flex-shrink: 0; }
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 8px; text-align: left; border-bottom: 1px solid #f0f0f0; font-size: 13px; }
th { color: #666; background: #fafafa; font-weight: 500; }
.thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 4px; background: #f5f5f5; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 12px; }
.tag.on { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.tag.off { background: #fff1f0; color: #ff4d4f; border: 1px solid #ffa39e; }
.pagination { margin-top: 16px; display: flex; gap: 8px; align-items: center; justify-content: flex-end; color: #666; }
.empty { text-align: center; color: #999; padding: 40px 0; }
.msg { padding: 10px 16px; border-radius: 4px; margin-bottom: 16px; }
.msg.ok { background: #f6ffed; color: #389e0d; border: 1px solid #b7eb8f; }
.msg.err { background: #fff1f0; color: #cf1322; border: 1px solid #ffa39e; }

/* ---------- 统计卡片 ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.stat-card { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.stat-card .num { font-size: 28px; font-weight: 600; color: #1890ff; }
.stat-card .label { color: #999; margin-top: 4px; }

/* ---------- 装修编辑器（三栏：左组件库 / 中手机预览 / 右属性编辑） ---------- */
.deco3 { display: flex; align-items: stretch; height: calc(100vh - 150px); min-height: 540px; background: #fff; border-radius: 8px; box-shadow: 0 1px 2px rgba(0,0,0,.05); overflow: hidden; }
.deco3-left { width: 230px; flex-shrink: 0; border-right: 1px solid #eee; overflow-y: auto; padding: 14px 12px; }
.deco3-center { flex: 1; min-width: 0; background: #f0f2f5; overflow-y: auto; display: flex; justify-content: center; align-items: flex-start; padding: 20px 16px; }
.deco3-right { width: 460px; flex-shrink: 0; border-left: 1px solid #eee; display: flex; flex-direction: column; background: #fff; }
.d3-side-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.d3-tip { color: #999; font-size: 12px; line-height: 1.6; margin-bottom: 6px; }
.d3-group-name { color: #666; font-size: 12px; margin: 12px 0 8px; }
.d3-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.d3-right-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid #f0f0f0; font-weight: 600; font-size: 14px; }
.d3-right-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 14px; }
.d3-right-body .input { min-width: 0; flex: 1 1 140px; }
.d3-right-body .form-row { flex-wrap: wrap; }
.d3-right-body .slide-ops .input { flex: 1 1 140px; }
/* 跳转类型 + 跳转目标 两个下拉强制并排一行 */
.zone-link-row { flex-wrap: nowrap !important; }
.zone-link-row .input { flex: 1 1 0; width: auto; }
.d3-empty { color: #999; text-align: center; padding: 60px 16px; line-height: 2; font-size: 13px; }
.comp-pos { color: #999; font-size: 12px; font-weight: 400; }
.comp-card.flat { border: none; margin-bottom: 0; box-shadow: none; }

.preview-label { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; text-align: center; color: #999; font-size: 12px; margin-bottom: 10px; }
.pv-panel { width: 375px; flex-shrink: 0; }
#phone-preview { width: 375px; }

/* 组件面板（平铺，点击添加 / 拖到中间手机里） */
.palette-item { padding: 10px 4px; background: #fafafa; border: 1px solid #e8e8e8; border-radius: 6px; text-align: center; cursor: grab; user-select: none; transition: .15s; }
.palette-item:hover { border-color: #1890ff; color: #1890ff; box-shadow: 0 2px 10px rgba(24,144,255,.16); transform: translateY(-1px); background: #fff; }
.palette-item:active { cursor: grabbing; }
.pi-icon { display: block; font-size: 22px; line-height: 1.5; }
.pi-name { display: block; font-size: 12px; }

/* 手机预览上的组件：点选 / 拖动排序 / 悬停删除 */
.pv-item { position: relative; cursor: pointer; }
.pv-item:hover { outline: 1px dashed #1890ff; outline-offset: -1px; }
.pv-item.selected { outline: 2px solid #1890ff; outline-offset: -2px; }
.pv-item.selected:hover { outline: 2px solid #1890ff; outline-offset: -2px; }
.pv-item:hover::before { content: '拖动排序'; position: absolute; top: 4px; left: 4px; background: rgba(24,144,255,.92); color: #fff; font-size: 10px; padding: 1px 5px; border-radius: 3px; pointer-events: none; z-index: 6; }
.pv-item.dragging { opacity: .35; }
/* 悬停出现的组件操作条：⧉复制 / 👁显隐 / ×删除 */
.pv-ops { position: absolute; top: 4px; right: 4px; display: none; gap: 4px; z-index: 7; }
.pv-item:hover .pv-ops, .pv-item.selected .pv-ops { display: flex; }
.pv-ops b { width: 20px; height: 20px; line-height: 19px; text-align: center; background: rgba(0,0,0,.55); color: #fff; border-radius: 50%; font-size: 11px; font-weight: 400; cursor: pointer; }
.pv-ops b:hover { background: #1890ff; }
.pv-ops b.pv-del { font-size: 14px; }
.pv-ops b.pv-del:hover { background: #ff4d4f; }
/* 被隐藏的组件：预览里半透明 + 斜纹，提醒你它不会发到线上 */
.pv-hidden { opacity: .42; }
.pv-hidden::after { content: '已隐藏'; position: absolute; top: 4px; left: 4px; background: rgba(0,0,0,.6); color: #fff; font-size: 10px; padding: 1px 5px; border-radius: 3px; z-index: 6; pointer-events: none; }
.pv-hidden:hover::before { display: none; }
.pv-drop-line { height: 3px; background: #1890ff; border-radius: 2px; margin: 3px 0; box-shadow: 0 0 0 2px rgba(24,144,255,.18); }

/* ---------- 装修页顶部：状态 + 操作按钮 ---------- */
.page-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.deco-status { font-size: 12px; font-weight: 400; color: #8c8c8c; display: inline-flex; align-items: center; gap: 5px; }
.deco-status b { color: #d4380d; font-weight: 600; }
.st-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: #52c41a; }
.st-dot.dirty { background: #faad14; box-shadow: 0 0 0 3px rgba(250,173,20,.18); }
.st-dot.ok { background: #52c41a; box-shadow: 0 0 0 3px rgba(82,196,26,.16); }
.deco-title-btns { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.deco-title-btns .btn[disabled] { opacity: .45; cursor: not-allowed; }
.d3-divider { height: 1px; background: #f0f0f0; margin: 12px 0; }

/* 手机外壳 */
.phone { background: #f5f5f5; border-radius: 24px; border: 6px solid #1a1a2e; overflow: hidden; box-shadow: 0 8px 30px rgba(0,0,0,.15); }
.phone-status { display: flex; justify-content: space-between; padding: 8px 16px; font-size: 11px; color: #333; background: #fff; }
.phone-nav { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; background: #fff; font-size: 14px; font-weight: 600; border-bottom: 1px solid #f0f0f0; }
.phone-capsule { border: 1px solid #ddd; border-radius: 20px; padding: 2px 8px; font-size: 11px; color: #666; }
/* 手机按内容完整撑开，不加内部滚动条；滚动交给外层 .deco3-center 一根滚动条负责 */
.phone-body { min-height: 480px; padding: 10px; font-size: 12px; }

/* 预览组件 */
.pv-banner { position: relative; margin: 4px; border-radius: 8px; overflow: hidden; height: 130px; background: #e8e8e8; }
.pv-banner img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pv-banner-empty { display: flex; align-items: center; justify-content: center; height: 100%; color: #999; }
.pv-dots { position: absolute; bottom: 6px; left: 0; right: 0; text-align: center; }
.pv-dots i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.6); margin: 0 3px; }
.pv-dots i.on { background: #fff; }
.pv-notice { display: flex; align-items: center; margin: 8px 4px; padding: 8px 10px; background: #fff; border-radius: 6px; }
.pv-tag { background: #e4393c; color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 3px; margin-right: 8px; flex-shrink: 0; }
.pv-text { color: #666; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-grid { margin: 8px 4px; }
.pv-title { font-size: 14px; font-weight: 600; margin-bottom: 8px; padding-left: 6px; border-left: 4px solid #e4393c; }
.pv-cards { display: flex; flex-wrap: wrap; gap: 6px; }
.pv-cards.cols-1 .pv-card { width: 100%; }
.pv-cards.cols-2 .pv-card { width: calc(50% - 3px); }
.pv-cards.cols-3 .pv-card { width: calc(33.33% - 4px); }
.pv-card { background: #fff; border-radius: 6px; overflow: hidden; }
.pv-card img { width: 100%; height: 100px; object-fit: cover; display: block; }
.pv-card-empty { width: 100%; height: 100px; background: #eee; }
.pv-cards.cols-3 img, .pv-cards.cols-3 .pv-card-empty { height: 70px; }
.pv-name { padding: 5px 7px 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-price { color: #e4393c; font-weight: 600; padding: 0 7px 7px; }
.pv-empty { text-align: center; color: #bbb; padding: 20px 0; width: 100%; }

/* ---------- 原组件编辑卡片 ---------- */
.comp-card { background: #fff; border: 1px solid #e8e8e8; border-radius: 8px; margin-bottom: 14px; }
.comp-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: #fafafa; border-bottom: 1px solid #f0f0f0; border-radius: 8px 8px 0 0; }
.comp-head b { font-size: 14px; }
.comp-body { padding: 14px; }
.slide-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.slide-ops { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 300px; }
.slide-ops .input { flex: 1; min-width: 200px; }
.goods-check-list { max-height: 220px; overflow-y: auto; border: 1px solid #f0f0f0; border-radius: 4px; padding: 8px 12px; }
.goods-check-item { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px dashed #f5f5f5; font-size: 13px; }
.phone-preview { background: #f5f5f5; border-radius: 12px; padding: 12px; max-width: 240px; }
.phone-preview .p-banner { background: #ddd; height: 90px; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: #999; font-size: 12px; margin-bottom: 8px; }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal { background: #fff; border-radius: 8px; padding: 24px; width: 640px; max-width: 94vw; max-height: 88vh; overflow-y: auto; }
.modal h3 { margin-bottom: 18px; font-size: 16px; }
.modal-footer { text-align: right; margin-top: 20px; }
.img-list { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.img-item { position: relative; width: 72px; height: 72px; }
.img-item img { width: 100%; height: 100%; object-fit: cover; border-radius: 4px; }
.img-item .del { position: absolute; top: -7px; right: -7px; width: 18px; height: 18px; background: #ff4d4f; color: #fff; border-radius: 50%; text-align: center; line-height: 18px; cursor: pointer; font-size: 12px; }
.size-tip { color: #d9534f; font-size: 12px; margin-top: 4px; line-height: 1.4; }

/* ---------- 统一的图片上传方块 + 子项行（轮播/热区/导航/图文富区共用） ---------- */
.ui-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px; margin-bottom: 10px; background: #fff; border: 1px solid #f0f0f0; border-radius: 6px; position: relative; }
.ui-row.zone-row.on { border-color: #1890ff; background: #f6fbff; }
.ui-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.img-col { flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
/* 尺寸提示跟在图片正下方、不换行 */
.img-col .size-tip { margin-top: 0; font-size: 11px; white-space: nowrap; }
.imgbox { display: flex; align-items: center; justify-content: center; overflow: hidden; background: #fafafa; border: 1px dashed #d9d9d9; border-radius: 6px; cursor: pointer; transition: .15s; }
.imgbox:hover { border-color: #1890ff; background: #f0f7ff; box-shadow: 0 2px 8px rgba(24,144,255,.15); }
.imgbox img { width: 100%; height: 100%; object-fit: cover; display: block; }
.imgbox .ib-plus { font-size: 22px; line-height: 1; color: #bbb; font-weight: 300; }
.imgbox:hover .ib-plus { color: #1890ff; }
/* 子项右上角的删除 × */
.row-del { position: absolute; top: 5px; right: 5px; width: 20px; height: 20px; padding: 0; line-height: 17px; text-align: center; font-size: 15px; border: none; background: #f5f5f5; color: #999; border-radius: 50%; cursor: pointer; }
.row-del:hover { background: #ff4d4f; color: #fff; }

/* ---------- 订单管理 ---------- */
.tag.st-0 { background: #fdf6ec; color: #e6a23c; border: 1rpx solid #f5dab1; }
.tag.st-1 { background: #fff1f0; color: #e4393c; border: 1px solid #ffccc7; }
.tag.st-2 { background: #ecf5ff; color: #409eff; border: 1px solid #b3d8ff; }
.tag.st-3 { background: #f0f9eb; color: #67c23a; border: 1px solid #c2e7b0; }
.tag.st-4 { background: #f4f4f5; color: #909399; border: 1px solid #d3d4d6; }
.order-info-grid p { font-size: 13px; line-height: 2; color: #555; }
textarea.input { min-width: 100%; height: 90px; resize: vertical; }

/* ---------- 新组件 · 编辑器控件 ---------- */
/* 热区图画布：用内部 <img> 撑出真实比例，百分比坐标与小程序端一致 */
.hotzone-canvas { position: relative; display: inline-block; max-width: 100%; overflow: hidden; border: 1px dashed #d9d9d9; border-radius: 6px; background: #fafafa; cursor: crosshair; user-select: none; }
.hotzone-canvas .hz-bg { display: block; width: 100%; height: auto; pointer-events: none; }
.hotzone-rect { position: absolute; border: 2px dashed #1890ff; background: rgba(24,144,255,.14); display: flex; align-items: center; justify-content: center; color: #1890ff; font-weight: 600; font-size: 12px; cursor: move; }
.hotzone-rect.active { border-color: #ff4d4f; background: rgba(255,77,79,.16); color: #ff4d4f; }
.hotzone-rect.drawing { border-style: solid; background: rgba(24,144,255,.22); }
.hotzone-rect .hz-num { pointer-events: none; text-shadow: 0 0 3px #fff; }
/* 八个拖拽手柄：四角 + 四边 */
.hz-handle { position: absolute; width: 9px; height: 9px; background: #ff4d4f; border: 1px solid #fff; border-radius: 2px; display: none; }
.hotzone-rect.active .hz-handle, .hotzone-rect:hover .hz-handle { display: block; }
.hz-handle.hz-nw { left: -5px; top: -5px; cursor: nwse-resize; }
.hz-handle.hz-n { left: 50%; top: -5px; margin-left: -5px; cursor: ns-resize; }
.hz-handle.hz-ne { right: -5px; top: -5px; cursor: nesw-resize; }
.hz-handle.hz-e { right: -5px; top: 50%; margin-top: -5px; cursor: ew-resize; }
.hz-handle.hz-se { right: -5px; bottom: -5px; cursor: nwse-resize; }
.hz-handle.hz-s { left: 50%; bottom: -5px; margin-left: -5px; cursor: ns-resize; }
.hz-handle.hz-sw { left: -5px; bottom: -5px; cursor: nesw-resize; }
.hz-handle.hz-w { left: -5px; top: 50%; margin-top: -5px; cursor: ew-resize; }
.hz-readout { position: absolute; left: 6px; bottom: 6px; background: rgba(0,0,0,.72); color: #fff; font-size: 11px; padding: 3px 8px; border-radius: 4px; display: none; pointer-events: none; font-family: Consolas, Menlo, monospace; }
.hz-tip { color: #8c8c8c; font-size: 12px; margin: 8px 0; line-height: 1.7; }
.hz-tip b { color: #1890ff; }
.zone-badge { width: 22px; height: 22px; line-height: 22px; border-radius: 50%; background: #1890ff; color: #fff; text-align: center; font-size: 12px; flex-shrink: 0; margin-top: 4px; cursor: pointer; }
.zone-row { border: 1px solid transparent; border-radius: 6px; padding: 6px; }
.zone-row.on { border-color: #ffccc7; background: #fff7f6; }

/* ---------- 新组件 · 实时预览 ---------- */
.pv-hotzone { position: relative; display: inline-block; max-width: 100%; margin: 4px; }
.pv-hotzone img { display: block; width: 100%; height: auto; }
.pv-zone { position: absolute; border: 1.5px dashed rgba(228,57,60,.85); background: rgba(228,57,60,.13); }
.pv-countdown { margin: 8px 4px; border-radius: 8px; padding: 12px 14px; color: #fff; }
.pv-cd-title { font-size: 15px; font-weight: 600; }
.pv-cd-sub { font-size: 11px; opacity: .85; margin-top: 2px; }
.pv-cd-time { display: inline-block; margin-top: 8px; background: rgba(0,0,0,.28); padding: 3px 10px; border-radius: 4px; font-weight: 700; font-size: 13px; letter-spacing: 1px; font-family: Consolas, Menlo, monospace; }
.pv-navgrid { display: flex; flex-wrap: wrap; margin: 8px 4px; background: #fff; border-radius: 8px; padding: 8px 2px; }
.pv-navgrid.cols-4 .pv-navitem { width: 25%; }
.pv-navgrid.cols-5 .pv-navitem { width: 20%; }
.pv-navitem { display: flex; flex-direction: column; align-items: center; gap: 5px; margin: 6px 0; }
.pv-navitem img { width: 28px; height: 28px; object-fit: cover; border-radius: 50%; }
.pv-navicon-empty { width: 28px; height: 28px; border-radius: 50%; background: #f0f0f0; }
.pv-navtext { font-size: 11px; color: #333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 90%; }
.pv-rich { margin: 8px 4px; background: #fff; border-radius: 8px; overflow: hidden; }
.pv-rich img { display: block; width: 100%; height: auto; }
.pv-rich-title { font-size: 14px; font-weight: 600; padding: 8px 10px 2px; }
.pv-rich-text { font-size: 12px; color: #888; padding: 2px 10px 10px; line-height: 1.7; white-space: pre-line; word-break: break-all; }
.pv-spacer { position: relative; display: flex; align-items: center; justify-content: center; }
.pv-line { width: 86%; border-top: 1px dashed #d9d9d9; }
