/* 建站工厂 · 编辑器 · 多级页面 */
:root {
  --bg: #f4f5f8;
  --panel: #ffffff;
  --line: #e8eaf0;
  --ink: #1f2330;
  --ink2: #4b5168;
  --muted: #8a90a4;
  --blue: #4f46e5;
  --blue-d: #4338ca;
  --orange: #f97316;
  --green: #10b981;
  --red: #ef4444;
  --shadow-sm: 0 1px 2px rgba(20,24,40,.06);
  --shadow: 0 4px 16px rgba(20,24,40,.08);
  --shadow-lg: 0 24px 60px rgba(20,24,40,.12);
  --radius: 10px;

  /* ===== 预设样式变量（被 data-style 覆盖；组件统一读这些变量） ===== */
  --p-bg: #ffffff;
  --p-ink: #1f2330;
  --p-ink2: #4b5168;
  --p-line: #e8eaf0;
  --p-header: #ffffff;
  --p-header-ink: var(--p-ink);
  --p-header-ink2: var(--p-ink2);
  --p-hover: var(--bg);
  --p-card: #ffffff;
  --p-card-line: #e8eaf0;
  --p-radius: 10px;
  --p-shadow: 0 4px 16px rgba(20,24,40,.08);
  --p-hero-bg: linear-gradient(135deg, color-mix(in srgb, var(--brand) 12%, #fff), #fff);
  --p-hero-align: center;
  --p-hero-ink: #1f2330;
  --p-hero-sub: #4b5168;
  --p-hero-pad: 60px 30px;
  --p-hero-radius: var(--p-radius);
  --p-font-head: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --p-cta-bg: var(--brand);
  --p-cta-ink: #ffffff;
  --p-cta-radius: 99px;
  --p-cta-band: var(--bg);
  /* 排版布局变量（被 data-layout 覆盖） */
  --p-cards-cols: 3;
  --p-card-pad: 18px;
  --p-card-icon: none;        /* tech 版式显示卡片图标装饰 */
  --p-section-gap: 22px;      /* 区块之间的间距（松/紧） */
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.app {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ===== 顶栏 ===== */
.topbar {
  height: 54px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  box-shadow: var(--shadow-sm);
  z-index: 5;
}
.top-left { display: flex; align-items: center; gap: 14px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.logo-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--blue), #8b5cf6);
  color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px;
}
.logo-text { font-weight: 700; font-size: 15px; }
.logo-text em { font-style: normal; font-size: 11px; color: var(--muted); margin-left: 4px; letter-spacing: 1px; }
.divider { width: 1px; height: 22px; background: var(--line); }
.site-name { display: flex; align-items: center; gap: 8px; }
.sitename { font-weight: 600; color: var(--ink2); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(16,185,129,.18); }
.top-right { display: flex; align-items: center; gap: 8px; }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid transparent;
  background: transparent; color: var(--ink); cursor: pointer; font-size: 13px; font-weight: 500;
  transition: all .15s;
}
.btn:hover { background: var(--bg); }
.btn.sm { padding: 6px 10px; font-size: 12px; }
.btn.ghost { border-color: var(--line); }
.btn.ghost:hover { border-color: #c5c9d4; background: var(--bg); }
.btn.solid { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn.solid:hover { background: var(--blue-d); }
.btn.block { width: 100%; justify-content: center; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #f97316, #ec4899);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px;
  margin-left: 4px;
}

/* ===== 工作区三栏 ===== */
.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 240px 1fr 320px;
  min-height: 0;
}
.sidebar, .inspector { background: var(--panel); border-right: 1px solid var(--line); overflow: hidden; display: flex; flex-direction: column; }
.inspector { border-right: 0; border-left: 1px solid var(--line); }

.side-tabs {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line);
}
.side-tabs .tab {
  border: 0; background: transparent; padding: 14px 0;
  font-size: 16px; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent;
}
.side-tabs .tab.active { color: var(--blue); border-bottom-color: var(--blue); }

.side-panel { padding: 14px 16px; overflow-y: auto; flex: 1; }
.side-panel h3 { margin: 0 0 4px; font-size: 14px; }
.side-panel .muted { color: var(--muted); font-size: 12px; margin: 0 0 12px; line-height: 1.55; }
.side-panel .muted.small { font-size: 11px; margin-top: 8px; }

#tplSearch {
  width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; margin-bottom: 10px;
}
#tplSearch:focus { outline: 0; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }

.tpl-mini-list { display: flex; flex-direction: column; gap: 4px; }
.tpl-mini {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: 8px; cursor: pointer;
}
.tpl-mini:hover { background: var(--bg); }
.tpl-mini.active { background: rgba(79,70,229,.08); }
.tpl-mini .mi-dot { width: 28px; height: 28px; border-radius: 8px; background: var(--c, var(--blue)); flex-shrink: 0; }
.tpl-mini .mi-title { font-weight: 600; font-size: 13px; }
.tpl-mini .mi-sub { font-size: 11px; color: var(--muted); }

.module-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mod-item {
  padding: 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
  font-size: 12px; background: #fff;
}
.mod-item:hover { border-color: var(--blue); background: rgba(79,70,229,.04); }

/* ===== 页面树 ===== */
#pageTree { display: flex; flex-direction: column; gap: 2px; }
.pt-row {
  display: flex; align-items: center; gap: 6px; padding: 7px 10px;
  border-radius: 8px; cursor: pointer; font-size: 13px;
}
.pt-row.sub { padding-left: 22px; }
.pt-row:hover { background: var(--bg); }
.pt-row.active { background: rgba(79,70,229,.1); color: var(--blue); font-weight: 600; }
.pt-icon { color: var(--muted); width: 14px; text-align: center; }
.pt-name { flex: 1; }
.pt-tools { display: none; gap: 2px; }
.pt-row:hover .pt-tools { display: flex; }
.pt-eye, .pt-del {
  border: 0; background: transparent; cursor: pointer; padding: 2px 6px;
  border-radius: 4px; font-size: 12px; color: var(--muted);
}
.pt-eye.on { color: var(--green); }
.pt-eye:hover, .pt-del:hover { background: var(--bg); color: var(--ink); }
.pt-sub { display: flex; flex-direction: column; gap: 2px; }
.pt-add { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.pt-add-btn {
  border: 1px dashed var(--line); background: transparent; border-radius: 8px;
  padding: 8px; cursor: pointer; font-size: 12px; color: var(--ink2);
}
.pt-add-btn:hover { border-color: var(--blue); color: var(--blue); }
.pt-add-btn.ghost { color: var(--muted); font-size: 11px; }

/* ===== 主题 ===== */
.theme-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 12px; }
.theme-card { width: 100%; aspect-ratio: 1; border: 0; border-radius: 8px; background: var(--c); cursor: pointer; box-shadow: inset 0 0 0 3px #fff; }
.theme-card:hover { box-shadow: inset 0 0 0 3px var(--blue); }
.field-label { display: block; font-size: 11px; color: var(--muted); margin: 8px 0 4px; }
input[type="color"], select { width: 100%; padding: 6px; border: 1px solid var(--line); border-radius: 6px; }

/* ===== 中央画布 ===== */
.canvas { background: var(--bg); overflow-y: auto; padding: 22px 26px; }

/* 模板选择器 */
.picker-head { text-align: center; margin-bottom: 22px; }
.picker-head h2 { margin: 0 0 6px; font-size: 22px; }
.picker-head .muted { color: var(--muted); margin: 0; }
.picker-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px;
  padding-bottom: 26px;
}
.pick-card {
  background: var(--panel); border-radius: 14px; overflow: hidden;
  box-shadow: var(--shadow-sm); cursor: pointer; transition: all .2s;
  display: flex; flex-direction: column;
}
.pick-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

/* 模板预览：模拟设计稿缩略（不再纯色块） */
.pick-preview {
  position: relative; aspect-ratio: 16/10;
  background: linear-gradient(135deg, var(--c) 0%, #fff 130%);
  padding: 14px;
}
.pm {
  width: 100%; height: 100%;
  background: #fff; border-radius: 8px;
  box-shadow: 0 6px 14px rgba(0,0,0,.18);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.pm-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-bottom: 1px solid #f0f1f5;
}
.pm-logo {
  width: 14px; height: 14px; border-radius: 4px;
  background: var(--c);
}
.pm-links { display: flex; gap: 4px; }
.pm-links span {
  width: 18px; height: 4px; border-radius: 2px; background: #d8dae3;
}
.pm-hero {
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  padding: 10px 12px; gap: 6px;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--c) 8%, #fff));
}
.pm-h1 { width: 70%; height: 7px; border-radius: 3px; background: var(--ink); }
.pm-h2 { width: 50%; height: 5px; border-radius: 2px; background: #c5c8d4; }
.pm-cta { width: 32px; height: 8px; border-radius: 4px; background: var(--c); margin-top: 2px; }
.pm-rows { display: flex; flex-direction: column; gap: 4px; padding: 6px 10px 10px; }
.pm-row { height: 12px; border-radius: 4px; background: #f1f2f7; }
.pm-row:nth-child(2) { width: 80%; }
.pick-tag {
  position: absolute; top: 10px; right: 10px;
  background: rgba(255,255,255,.95); color: var(--c);
  font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 99px;
}
.pick-emoji {
  position: absolute; bottom: 10px; right: 12px;
  font-size: 22px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.15));
}
.pick-body { padding: 12px 14px 14px; }
.pick-body h3 { margin: 0 0 2px; font-size: 15px; }
.pick-sub { color: var(--muted); font-size: 12px; margin: 0 0 10px; }
.pick-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; font-size: 11px; color: var(--ink2); }
.pick-meta span { background: var(--bg); padding: 3px 8px; border-radius: 99px; }
.pick-color { font-family: ui-monospace, monospace !important; text-transform: uppercase; }
.pick-cta {
  width: 100%; padding: 8px; border: 0; border-radius: 8px;
  background: var(--c); color: #fff; font-weight: 600; cursor: pointer; font-size: 13px;
}
.pick-cta:hover { filter: brightness(0.92); }

/* 设计画布 */
.design { display: flex; flex-direction: column; min-height: 100%; }
.design-toolbar {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
}
.crumb { color: var(--muted); font-size: 12px; flex: 1; }
.viewport-switch { display: flex; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.vs-btn { border: 0; background: transparent; padding: 6px 12px; cursor: pointer; font-size: 12px; color: var(--ink2); }
.vs-btn.active { background: var(--blue); color: #fff; }

/* ===== 画布顶部显眼快捷栏：预设样式库 + 一键换色 ===== */
.quickbar {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin-bottom: 12px;
  background: linear-gradient(180deg, #ffffff, #f6f7fc);
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-sm);
}
.qb-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 15px; border-radius: 9px; cursor: pointer;
  font-size: 13px; font-weight: 600; border: 1px solid var(--line);
  background: #fff; color: var(--ink); transition: all .15s; white-space: nowrap;
}
.qb-btn:hover { border-color: var(--blue); color: var(--blue); }
.qb-btn.preset-toggle { background: linear-gradient(135deg, var(--blue), #8b5cf6); color: #fff; border-color: transparent; }
.qb-btn.preset-toggle:hover { filter: brightness(1.06); color: #fff; }
.qb-btn.preset-toggle .caret { font-size: 10px; opacity: .85; }
.qb-btn.color { background: var(--ink); color: #fff; border-color: transparent; }
.qb-btn.color:hover { filter: brightness(1.12); color: #fff; }
.qb-hint { color: var(--muted); font-size: 12px; margin-left: auto; }

/* 预设样式弹层（12 套缩略图） */
.preset-popover {
  position: absolute; top: calc(100% + 8px); left: 10px; z-index: 40;
  width: min(680px, calc(100vw - 70px)); max-height: 62vh; overflow: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 14px;
}
.preset-popover[hidden] { display: none; }
.pp-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.pp-head b { font-size: 14px; color: var(--ink); }
.pp-head small { color: var(--muted); font-weight: 400; }
.preset-popover .preset-grid { margin-bottom: 0; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.preset-popover .preset-card { cursor: pointer; }

/* 站点真实导航条 */
.site-header {
  display: flex; align-items: center; gap: 18px;
  padding: 12px 22px; background: var(--p-header);
  border: 1px solid var(--p-line); border-radius: 12px 12px 0 0;
  box-shadow: var(--shadow-sm);
  position: sticky; top: 0; z-index: 2;
}
.sh-logo { display: flex; align-items: center; gap: 8px; font-weight: 700; cursor: pointer; text-decoration: none; color: var(--p-header-ink); flex-shrink: 0; white-space: nowrap; }
.sh-logo-dot { width: 22px; height: 22px; border-radius: 6px; background: var(--brand, var(--blue)); }
.sh-menu { display: flex; gap: 4px; flex: 1; margin-left: 18px; }
.sh-item { position: relative; flex-shrink: 0; }
.sh-item > a {
  display: block; padding: 8px 14px; border-radius: 6px;
  text-decoration: none; color: var(--p-header-ink2); font-size: 13px; cursor: pointer;
  white-space: nowrap;
}
.sh-item > a:hover { background: var(--p-hover); color: var(--p-header-ink); }
.sh-item.active > a { color: var(--brand, var(--blue)); font-weight: 600; }
.sh-item.has-children > a::after { content: ' ▾'; font-size: 10px; color: var(--muted); }
.sh-sub {
  position: absolute; top: 100%; left: 0; min-width: 180px;
  background: var(--p-header); border: 1px solid var(--p-line); border-radius: 8px;
  box-shadow: var(--shadow); padding: 6px; display: none; z-index: 3;
}
.sh-item:hover .sh-sub, .sh-item.has-children:hover .sh-sub { display: block; }
.sh-sub a { display: block; padding: 8px 10px; border-radius: 6px; text-decoration: none; color: var(--p-header-ink2); font-size: 13px; }
.sh-sub a:hover, .sh-sub a.active { background: var(--p-hover); color: var(--brand, var(--blue)); }
.sh-cta {
  padding: 8px 16px; border-radius: 8px; background: var(--brand, var(--blue));
  color: #fff !important; font-weight: 600; text-decoration: none; font-size: 13px;
  flex-shrink: 0; white-space: nowrap;
}

/* 画布 stage */
.design-stage {
  flex: 1; min-height: 600px;
  background: var(--p-bg); border: 1px solid var(--p-line); border-top: 0;
  border-radius: 0 0 12px 12px;
  padding: 26px; transition: max-width .25s; margin: 0 auto; width: 100%;
  box-shadow: var(--shadow-sm);
}
.design-stage.tablet { max-width: 820px; }
.design-stage.mobile { max-width: 420px; }

.empty-page { text-align: center; padding: 80px 20px; color: var(--muted); }
.empty-icon { font-size: 56px; margin-bottom: 12px; opacity: .5; }

/* 区块 */
.block {
  position: relative; margin-bottom: 18px;
  border: 2px dashed transparent; border-radius: 10px;
  padding: 14px; transition: all .15s;
}
.block:hover { border-color: rgba(79,70,229,.35); background: rgba(79,70,229,.02); }
.block.selected { border-color: var(--blue); background: rgba(79,70,229,.04); }
.edit-tag {
  position: absolute; top: -10px; right: 12px;
  background: var(--blue); color: #fff; font-size: 11px;
  padding: 2px 8px; border-radius: 99px; opacity: 0;
}
.block:hover .edit-tag, .block.selected .edit-tag { opacity: 1; }
.drag-handle {
  position: absolute; top: -11px; left: 12px;
  width: 24px; height: 22px; border-radius: 99px;
  display: grid; place-items: center; cursor: grab;
  background: #fff; border: 1px solid var(--line); color: var(--muted);
  font-size: 13px; opacity: 0; transition: opacity .15s, color .15s;
  touch-action: none;
}
.block:hover .drag-handle, .block.selected .drag-handle { opacity: 1; }
.drag-handle:hover { color: var(--blue); border-color: var(--blue); }
.drag-handle:active { cursor: grabbing; }
.block { cursor: default; }
.block.dragging { opacity: .45; }
.block.drop-before { box-shadow: 0 -3px 0 0 var(--blue); }
.block.drop-after  { box-shadow: 0  3px 0 0 var(--blue); }
.color-row.compact { margin: 8px 0 0; }

/* Hero */
.b-hero {
  text-align: var(--p-hero-align); padding: var(--p-hero-pad);
  border-radius: var(--p-hero-radius);
  background: var(--p-hero-bg);
}
.hero-title { font-size: 36px; margin: 0 0 12px; font-weight: 800; color: var(--p-hero-ink); letter-spacing: -.5px; font-family: var(--p-font-head); }
.hero-sub { color: var(--p-hero-sub); margin: 0 0 22px; font-size: 16px; }
.hero-cta {
  display: inline-block; padding: 12px 24px; border-radius: var(--p-cta-radius);
  background: var(--p-cta-bg); color: var(--p-cta-ink); font-weight: 600; font-size: 14px;
}
.hero-img {
  margin-top: 28px; aspect-ratio: 21/9; border-radius: var(--p-radius);
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 25%, #fff), #e9ebf3);
  display: grid; place-items: center; color: var(--muted); font-size: 13px;
}
.b-text { padding: 24px 6px; max-width: 760px; margin: 0 auto; }
.b-text h4 { font-size: 22px; margin: 0 0 10px; font-family: var(--p-font-head); }
.b-text p { color: var(--p-ink2); line-height: 1.7; margin: 0; }
.b-image .img-placeholder {
  aspect-ratio: 21/9; border-radius: var(--p-radius);
  background: linear-gradient(135deg, #f0f1f7, #e2e5ee);
  display: grid; place-items: center; color: var(--muted);
}
.b-image .muted { color: var(--muted); text-align: center; margin-top: 8px; }
.b-cards h4 { margin: 0 0 10px; font-size: 20px; font-family: var(--p-font-head); }
.b-cards-grid { display: grid; grid-template-columns: repeat(var(--p-cards-cols, 3), 1fr); gap: 14px; }
.b-cards .card {
  padding: var(--p-card-pad); border-radius: var(--p-radius); background: var(--p-card);
  border: 1px solid var(--p-card-line); transition: all .15s; position: relative;
}
/* 卡片图标装饰块：仅 tech 版式显示 */
.b-cards .card::before {
  content: ''; display: var(--p-card-icon); width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 55%, #1f2937));
  margin-bottom: 12px; box-shadow: 0 6px 14px color-mix(in srgb, var(--brand) 35%, transparent);
}
.b-cards .card:hover { border-color: var(--blue); transform: translateY(-2px); box-shadow: var(--p-shadow); }
.b-cards .card h5 { margin: 0 0 6px; font-size: 14px; }
.b-cards .card p { color: var(--muted); margin: 0; font-size: 12px; }
.b-form { max-width: 520px; margin: 0 auto; padding: 24px 0; }
.b-form h4 { text-align: center; margin: 0 0 14px; font-size: 20px; font-family: var(--p-font-head); }
.form-fields { display: flex; flex-direction: column; gap: 8px; }
.form-fields input {
  padding: 10px 12px; border: 1px solid var(--p-line); border-radius: 8px; font-size: 13px;
}
.form-fields button {
  padding: 10px; border: 0; border-radius: 8px;
  background: var(--brand); color: #fff; font-weight: 600; cursor: pointer;
}
.b-cta { text-align: center; padding: 50px 20px; background: var(--p-cta-band); border-radius: var(--p-radius); }
.b-cta h3 { margin: 0 0 8px; font-size: 28px; font-family: var(--p-font-head); }
.b-cta p { color: var(--muted); margin: 0 0 18px; }
.b-cta button { padding: 12px 28px; border: 0; border-radius: var(--p-cta-radius); background: var(--p-cta-bg); color: var(--p-cta-ink); font-weight: 600; cursor: pointer; }
.b-video { aspect-ratio: 16/9; background: linear-gradient(135deg, #1f2330, #2a2f45); border-radius: var(--p-radius); display: grid; place-items: center; color: #fff; font-size: 16px; }
.b-map { aspect-ratio: 21/9; background: linear-gradient(135deg, #e2e5ee, #d8dce8); border-radius: var(--p-radius); display: grid; place-items: center; color: var(--ink2); }

/* 区块间距：随版式松紧变化 */
.design-stage > * { margin-bottom: var(--p-section-gap); }
.design-stage > *:last-child { margin-bottom: 0; }

/* ===== 属性面板 ===== */
.ins-head { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.ins-head h3 { margin: 0; font-size: 14px; }
.ins-head .muted { font-size: 11px; }
.ins-body { padding: 14px 16px; overflow-y: auto; flex: 1; }
.ins-empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.ins-empty-icon { font-size: 38px; margin-bottom: 8px; opacity: .5; }
.ins-empty ul { text-align: left; padding-left: 20px; margin-top: 10px; font-size: 12px; line-height: 1.7; }
.field { margin-bottom: 10px; }
.field label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.field input, .field textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px;
  font-size: 13px; font-family: inherit; resize: vertical;
}
.field input:focus, .field textarea:focus { outline: 0; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
.field textarea { min-height: 80px; }
.row-btns { display: flex; gap: 6px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.row-btns .btn { flex: 1; justify-content: center; }

/* ===== 状态条 ===== */
.statusbar {
  height: 26px; background: var(--panel); border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; font-size: 11px; color: var(--muted);
}

/* ======================================================================
   版式系统 · 6 套排版样式（只管排版：对齐/栅格/字体/明暗/圆角/间距）
   颜色由 --brand 独立控制；版式通过 #design[data-layout="x"] 切换
   ====================================================================== */

/* 1 · 现代简约 modern（常规通用）— 居中 · 大留白 · 细线 · 圆角 */
#design[data-layout="modern"] {
  --p-bg:#ffffff; --p-ink:#14151a; --p-ink2:#5b606e; --p-line:#ececf2;
  --p-header:#ffffff; --p-header-ink:#14151a; --p-header-ink2:#5b606e; --p-hover:#f6f6f8;
  --p-card:#ffffff; --p-card-line:#ececf2; --p-radius:8px; --p-shadow:0 2px 10px rgba(20,24,40,.05);
  --p-hero-bg:#ffffff; --p-hero-align:center; --p-hero-ink:#14151a; --p-hero-sub:#5b606e;
  --p-hero-pad:88px 60px; --p-hero-radius:12px;
  --p-font-head:'Inter','PingFang SC','Microsoft YaHei',sans-serif;
  --p-cards-cols:3; --p-card-pad:22px; --p-card-icon:none; --p-section-gap:28px;
  --p-cta-bg:var(--brand); --p-cta-ink:#ffffff; --p-cta-radius:99px; --p-cta-band:#f7f7f9;
}
#design[data-layout="modern"] .b-hero { border:1px solid var(--p-line); }

/* 2 · 经典商务 corporate（常规·商务）— 左对齐 · 两栏 · 直角 */
#design[data-layout="corporate"] {
  --p-bg:#f4f6f9; --p-ink:#16213a; --p-ink2:#56607a; --p-line:#dde3ec;
  --p-header:#ffffff; --p-header-ink:#16213a; --p-header-ink2:#56607a; --p-hover:#eef2f7;
  --p-card:#ffffff; --p-card-line:#dde3ec; --p-radius:4px; --p-shadow:0 2px 10px rgba(20,30,60,.06);
  --p-hero-bg:linear-gradient(180deg,#eef2f7,#ffffff);
  --p-hero-align:left; --p-hero-ink:#16213a; --p-hero-sub:#56607a; --p-hero-pad:64px 40px; --p-hero-radius:4px;
  --p-font-head:'Inter','PingFang SC','Microsoft YaHei',sans-serif;
  --p-cards-cols:2; --p-card-pad:20px; --p-card-icon:none; --p-section-gap:18px;
  --p-cta-bg:var(--brand); --p-cta-ink:#ffffff; --p-cta-radius:4px; --p-cta-band:#eef2f7;
}
#design[data-layout="corporate"] .b-cards .card { box-shadow:none; }

/* 3 · 杂志编辑 editorial（流行·媒体设计）— 衬线大标题 · 米色 · 多栏 */
#design[data-layout="editorial"] {
  --p-bg:#fbf7f0; --p-ink:#2b2620; --p-ink2:#6f6657; --p-line:#e5dccb;
  --p-header:#fffdf9; --p-header-ink:#2b2620; --p-header-ink2:#6f6657; --p-hover:#f4ecdf;
  --p-card:#fffdf9; --p-card-line:#e5dccb; --p-radius:2px; --p-shadow:0 4px 14px rgba(120,90,50,.08);
  --p-hero-bg:linear-gradient(180deg,#fbf1e3,#fbf7f0);
  --p-hero-align:left; --p-hero-ink:#2b2620; --p-hero-sub:#7a6f5e; --p-hero-pad:72px 52px; --p-hero-radius:2px;
  --p-font-head:'Playfair Display','Noto Serif SC',Georgia,'Songti SC',serif;
  --p-cards-cols:3; --p-card-pad:22px; --p-card-icon:none; --p-section-gap:26px;
  --p-cta-bg:var(--brand); --p-cta-ink:#ffffff; --p-cta-radius:2px; --p-cta-band:#f4ecdf;
}
#design[data-layout="editorial"] .hero-title { letter-spacing:0; }
#design[data-layout="editorial"] .b-text p, #design[data-layout="editorial"] .b-cards .card p { font-family:Georgia,'Noto Serif SC',serif; }

/* 4 · 科技卡片 tech（主流·科技 SaaS）— 光晕 Hero · 图标卡 · 发光 */
#design[data-layout="tech"] {
  --p-bg:#ffffff; --p-ink:#1f2937; --p-ink2:#5b6678; --p-line:#e6e9f0;
  --p-header:#ffffff; --p-header-ink:#1f2937; --p-header-ink2:#5b6678; --p-hover:#f3f6ff;
  --p-card:#ffffff; --p-card-line:#e6e9f0; --p-radius:12px; --p-shadow:0 8px 24px rgba(40,70,160,.10);
  --p-hero-bg:radial-gradient(120% 140% at 70% 0%, color-mix(in srgb, var(--brand) 16%, #fff), #f5f8ff 60%);
  --p-hero-align:center; --p-hero-ink:#1f2937; --p-hero-sub:#5b6678; --p-hero-pad:72px 30px; --p-hero-radius:14px;
  --p-font-head:'Inter','PingFang SC','Microsoft YaHei',sans-serif;
  --p-cards-cols:3; --p-card-pad:20px; --p-card-icon:block; --p-section-gap:24px;
  --p-cta-bg:var(--brand); --p-cta-ink:#ffffff; --p-cta-radius:99px; --p-cta-band:#f3f6ff;
}

/* 5 · 电商大促 commerce（流行·零售电商）— 全宽色块 · 4 列网格 · 0 圆角 */
#design[data-layout="commerce"] {
  --p-bg:#ffffff; --p-ink:#14151a; --p-ink2:#44444f; --p-line:#e6e6e6;
  --p-header:#14151a; --p-header-ink:#ffffff; --p-header-ink2:rgba(255,255,255,.7); --p-hover:rgba(255,255,255,.08);
  --p-card:#ffffff; --p-card-line:#e6e6e6; --p-radius:0px; --p-shadow:none;
  --p-hero-bg:var(--brand); --p-hero-align:left; --p-hero-ink:#ffffff; --p-hero-sub:rgba(255,255,255,.85);
  --p-hero-pad:80px 56px; --p-hero-radius:0px;
  --p-font-head:'Inter','PingFang SC','Microsoft YaHei',sans-serif;
  --p-cards-cols:4; --p-card-pad:16px; --p-card-icon:none; --p-section-gap:16px;
  --p-cta-bg:#14151a; --p-cta-ink:#ffffff; --p-cta-radius:0px; --p-cta-band:#14151a;
}
#design[data-layout="commerce"] .b-hero { color:#fff; }
#design[data-layout="commerce"] .b-cards .card { border:1px solid #e6e6e6; box-shadow:none; }
#design[data-layout="commerce"] .b-cta { color:#fff; }
#design[data-layout="commerce"] .b-cta h3, #design[data-layout="commerce"] .b-cta p { color:#fff; }
#design[data-layout="commerce"] .b-cta button { background:#fff; color:#14151a; }
#design[data-layout="commerce"] .form-fields button { background:var(--brand); color:#14151a; }
#design[data-layout="commerce"] .hero-img { background:linear-gradient(135deg, rgba(0,0,0,.35), rgba(0,0,0,.55)); color:rgba(255,255,255,.85); }

/* 6 · 深色作品集 dark（流行·创作者科技）— 暗底 · 径向光晕 · 大字 */
#design[data-layout="dark"] {
  --p-bg:#0e1117; --p-ink:#e8eaf0; --p-ink2:#a9b0c2; --p-line:#222a3a;
  --p-header:#121722; --p-header-ink:#e8eaf0; --p-header-ink2:#a9b0c2; --p-hover:rgba(255,255,255,.06);
  --p-card:#161b26; --p-card-line:#222a3a; --p-radius:10px; --p-shadow:0 8px 24px rgba(0,0,0,.35);
  --p-hero-bg:radial-gradient(120% 130% at 72% 0%, color-mix(in srgb, var(--brand) 30%, #161b26), #0e1117 62%);
  --p-hero-align:center; --p-hero-ink:#f3f5fb; --p-hero-sub:#aeb6c8; --p-hero-pad:72px 30px; --p-hero-radius:14px;
  --p-font-head:'Inter','PingFang SC','Microsoft YaHei',sans-serif;
  --p-cards-cols:3; --p-card-pad:20px; --p-card-icon:none; --p-section-gap:22px;
  --p-cta-bg:var(--brand); --p-cta-ink:#ffffff; --p-cta-radius:99px; --p-cta-band:#121722;
}
#design[data-layout="dark"] .b-text h4, #design[data-layout="dark"] .b-text p { color:#e8eaf0; }
#design[data-layout="dark"] .b-text p { color:#aeb6c8; }
#design[data-layout="dark"] .b-cards .card h5 { color:#e8eaf0; }
#design[data-layout="dark"] .b-cards .card p { color:#8a93a8; }
#design[data-layout="dark"] .b-image .muted, #design[data-layout="dark"] .b-form .muted { color:#8a93a8; }
#design[data-layout="dark"] .b-cta h3 { color:#f3f5fb; }
#design[data-layout="dark"] .b-cta p { color:#aeb6c8; }
#design[data-layout="dark"] .b-video { background:linear-gradient(135deg,#1a2030,#0e1117); }
#design[data-layout="dark"] .b-map { background:linear-gradient(135deg,#1b2230,#161b26); color:#a9b0c2; }
#design[data-layout="dark"] .form-fields input { background:#0e1117; border-color:#2a3346; color:#e8eaf0; }
#design[data-layout="dark"] .hero-img { background:linear-gradient(135deg, color-mix(in srgb, var(--brand) 22%, #161b26), #0e1117); color:#8a93a8; }

/* ===== 主题面板 · 风格预设卡片 ===== */
/* ===== 主题面板 · 颜色（一键取色 / 选色卡） ===== */
.color-grid { display:grid; grid-template-columns:repeat(5,1fr); gap:6px; margin-bottom:8px; }
.color-chip {
  height:26px; border-radius:7px; cursor:pointer; border:2px solid transparent; transition:transform .12s;
}
.color-chip:hover { transform:scale(1.08); }
.color-chip.active { box-shadow:0 0 0 2px #fff, 0 0 0 4px var(--ink); }
.color-row { display:flex; align-items:center; gap:8px; margin-bottom:14px; }
.color-row input[type=color] {
  width:42px; height:32px; padding:0; border:1px solid var(--line); border-radius:8px; background:#fff; cursor:pointer;
}
.color-row .hex { font-size:12px; color:var(--ink2); font-family:ui-monospace,Menlo,monospace; }

/* ===== 主题面板 · 预设样式（成套外观，客户一键调取） ===== */
.preset-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-bottom:6px; }
.preset-card {
  border:1px solid var(--line); border-radius:10px; padding:6px; cursor:pointer;
  background:#fff; transition:all .15s;
}
.preset-card:hover { border-color:var(--blue); transform:translateY(-1px); }
.preset-card.active { border-color:var(--blue); box-shadow:0 0 0 3px rgba(79,70,229,.14); }
.preset-thumb {
  position:relative; aspect-ratio:16/10; border-radius:6px; overflow:hidden;
  background:#fff; margin-bottom:5px;
}
.preset-thumb .pm { box-shadow:none; border-radius:0; }
.pc-name { font-size:12px; font-weight:600; color:var(--ink); }
.pc-cat { font-size:10px; color:var(--muted); }
.sep { border:0; border-top:1px solid var(--line); margin:14px 0 10px; }
.block-label { font-size:11px; font-weight:700; color:var(--ink2); letter-spacing:.03em; margin:10px 0 6px; }

/* ===== 主题面板 · 版式预设（排版样式） ===== */
.layout-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.layout-card {
  border:1px solid var(--line); border-radius:10px; padding:8px; cursor:pointer;
  background:#fff; transition:all .15s;
}
.layout-card:hover { border-color:var(--blue); }
.layout-card.active { border-color:var(--blue); box-shadow:0 0 0 3px rgba(79,70,229,.12); }
.layout-swatch {
  height:46px; border-radius:6px; overflow:hidden; position:relative;
  margin-bottom:6px; display:flex; flex-direction:column; justify-content:center; gap:5px; padding:0 9px;
}
.layout-swatch .ls-bar { height:7px; width:42%; border-radius:4px; background:var(--ac,#4f46e5); }
.layout-swatch .ls-line { height:4px; width:72%; border-radius:2px; background:rgba(120,120,140,.35); }
.layout-swatch .ls-grid { display:flex; gap:3px; margin-top:2px; }
.layout-swatch .ls-grid i { flex:1; height:7px; border-radius:2px; background:rgba(120,120,140,.25); }
.lv-modern { background:#fff; border:1px solid #ececf2; } .lv-modern .ls-bar{background:#14151a;}
.lv-corporate { background:#eef2f7; } .lv-corporate .ls-bar{background:#1d4ed8;} .lv-corporate .ls-grid i{flex:none;width:30%;}
.lv-editorial { background:#fbf1e3; } .lv-editorial .ls-bar{background:#2b2620; font-style:italic;}
.lv-tech { background:radial-gradient(120% 140% at 70% 0%, rgba(79,70,229,.18), #fff); } .lv-tech .ls-bar{background:#4f46e5;} .lv-tech .ls-grid i:first-child{background:#4f46e5;}
.lv-commerce { background:#3b82f6; } .lv-commerce .ls-bar{background:#fff;} .lv-commerce .ls-grid i{background:rgba(255,255,255,.7);}
.lv-dark { background:#0e1117; } .lv-dark .ls-bar{background:#8b5cf6;} .lv-dark .ls-line{background:#2a3346;} .lv-dark .ls-grid i{background:#2a3346;}
.lc-name { font-size:12px; font-weight:600; color:var(--ink); }
.lc-cat { font-size:10px; color:var(--muted); }

/* ===== 模板库缩略图 · 按版式区分外观 ===== */
.pv-modern { background:#fff; }
.pv-modern .pm { border:1px solid #ececf2; }
.pv-modern .pm-hero { background:#fafafa; align-items:center; }
.pv-modern .pm-h1 { background:#14151a; }
.pv-modern .pm-cta { background:var(--c); border-radius:99px; }

.pv-corporate { background:#f5f7fa; }
.pv-corporate .pm { background:#fff; border:1px solid #dde3ec; }
.pv-corporate .pm-hero { background:#eef2f7; align-items:flex-start; }
.pv-corporate .pm-cta { background:var(--c); border-radius:4px; }

.pv-editorial { background:#fbf6ef; }
.pv-editorial .pm { background:#fffdf9; border:1px solid #efe6d8; font-family:Georgia,'Noto Serif SC',serif; }
.pv-editorial .pm-hero { background:#fbf1e3; align-items:flex-start; }
.pv-editorial .pm-h1 { background:#2b2620; }
.pv-editorial .pm-cta { background:var(--c); border-radius:2px; }

.pv-tech { background:#fff; }
.pv-tech .pm { border:1px solid #e6e9f0; }
.pv-tech .pm-hero { background:radial-gradient(120% 140% at 70% 0%, color-mix(in srgb, var(--c) 18%, #fff), #f5f8ff 60%); }
.pv-tech .pm-h1 { background:#1f2937; }
.pv-tech .pm-cta { background:var(--c); border-radius:99px; }

.pv-commerce { background:var(--c); }
.pv-commerce .pm { background:#fff; box-shadow:0 8px 20px rgba(0,0,0,.25); }
.pv-commerce .pm-nav { border-color:color-mix(in srgb, var(--c) 40%, #cfcfcf); }
.pv-commerce .pm-hero { background:var(--c); align-items:flex-start; }
.pv-commerce .pm-hero .pm-h1 { background:#fff; }
.pv-commerce .pm-hero .pm-h2 { background:rgba(255,255,255,.7); }
.pv-commerce .pm-hero .pm-cta { background:#14151a; }
.pv-commerce .pm-links span { background:color-mix(in srgb, var(--c) 35%, #cfcfcf); }

.pv-dark { background:#0e1117; }
.pv-dark .pm { background:#161b26; box-shadow:0 6px 14px rgba(0,0,0,.4); }
.pv-dark .pm-nav { border-color:#222a3a; }
.pv-dark .pm-links span { background:#2a3346; }
.pv-dark .pm-h1 { background:#e8eaf0; }
.pv-dark .pm-h2 { background:#3a4356; }
.pv-dark .pm-cta { background:var(--c); }
.pv-dark .pm-rows .pm-row { background:#1d2433; }
.pv-dark .pm-hero { background:linear-gradient(180deg, transparent, color-mix(in srgb, var(--c) 16%, #161b26)); }
/* ===== 画布元素级自由拖动 ===== */
#designStage [data-drag-el] {
  position: relative;
  cursor: move;
  touch-action: none;
}
#designStage [data-drag-el].el-dragging {
  cursor: grabbing;
}

/* ===== 手机端响应式：三栏 → 画布全屏 + 侧栏覆盖 + 底部 Tab ===== */
.mobile-tabbar { display: none; }

@media (max-width: 820px) {
  body.app { height: 100vh; }
  .workspace { flex: 1; min-height: 0; display: block; overflow: hidden; }
  .canvas {
    width: 100%; height: calc(100% - 56px); padding: 14px;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
  }
  /* 预览画布在真手机上铺满，不再缩窄 */
  .design-stage.tablet, .design-stage.mobile { max-width: 100%; margin: 0; }

  /* 侧栏 / 属性面板变成全屏覆盖层，从左右滑入 */
  .sidebar, .inspector {
    position: fixed;
    top: 54px; bottom: 56px;
    width: 100%; max-width: 100%;
    z-index: 60;
    background: var(--panel);
    box-shadow: var(--shadow-lg);
    transition: transform .22s ease;
  }
  .sidebar { left: 0; transform: translateX(-100%); }
  .inspector { right: 0; transform: translateX(100%); border-left: 1px solid var(--line); }
  .sidebar.open, .inspector.open { transform: translateX(0); }

  /* 手机无 hover，区块排序手柄常显，让客户知道能拖 */
  .drag-handle { opacity: 1; background: var(--blue); color: #fff; border-color: var(--blue); }

  /* 底部 Tab 栏 */
  .mobile-tabbar {
    display: flex;
    position: fixed; left: 0; right: 0; bottom: 0;
    height: 56px; z-index: 70;
    background: var(--panel);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .mobile-tabbar button {
    flex: 1; border: 0; background: transparent;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; font-size: 11px; color: var(--muted); cursor: pointer;
  }
  .mobile-tabbar button .ico { font-size: 19px; line-height: 1; }
  .mobile-tabbar button.active { color: var(--blue); }

  .statusbar { display: none; }
  .top-hide-sm { display: none; }
}

/* ===== AI 建站对话框 ===== */
.ai-modal { position: fixed; inset: 0; background: rgba(20,21,26,.45); display: grid; place-items: center; z-index: 200; padding: 16px; }
.ai-modal[hidden] { display: none; }
.ai-card { width: min(520px, 92vw); background: #fff; border-radius: 14px; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.ai-head { display: flex; justify-content: space-between; align-items: center; font-size: 16px; font-weight: 600; color: #1c1f2b; }
.ai-close { border: none; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: #9aa0b4; padding: 0 4px; }
.ai-close:hover { color: #4b5168; }
.ai-card .muted { margin: 6px 0 0; font-size: 13px; }
.ai-card textarea { width: 100%; box-sizing: border-box; border: 1px solid #e3e6ef; border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 14px; resize: vertical; margin-top: 12px; }
.ai-card textarea:focus { outline: 2px solid #4f46e5; outline-offset: 0; border-color: transparent; }
.ai-examples { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.ai-chip { border: 1px dashed #4f46e5; background: #eef2ff; color: #4f46e5; border-radius: 99px; padding: 6px 12px; font-size: 12px; cursor: pointer; }
.ai-chip:hover { background: #e0e7ff; }
.ai-card .btn.solid { width: 100%; margin-top: 12px; background: #4f46e5; }
.ai-loading { text-align: center; padding: 22px 10px 14px; }
.ai-spinner { width: 44px; height: 44px; margin: 0 auto 16px; border: 4px solid #e6e8f2; border-top-color: #4f46e5; border-radius: 50%; animation: ai-spin .8s linear infinite; }
@keyframes ai-spin { to { transform: rotate(360deg); } }
.ai-loading-title { font-size: 17px; font-weight: 700; color: #1c1f2b; }
.ai-loading-step { font-size: 14px; color: #4f46e5; margin-top: 12px; min-height: 20px; transition: opacity .2s; }
.ai-loading-sub { font-size: 12px; color: #9aa0b4; margin-top: 8px; }
.deploy-modal { position: fixed; inset: 0; background: rgba(20,21,26,.45); display: grid; place-items: center; z-index: 210; padding: 16px; overflow: auto; }
.deploy-modal[hidden] { display: none; }
.deploy-card { width: min(620px, 94vw); background: #fff; border-radius: 14px; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.25); max-height: 92vh; overflow: auto; }
.deploy-h { font-size: 14px; font-weight: 700; color: #1c1f2b; margin: 18px 0 8px; }
.deploy-h:first-of-type { margin-top: 6px; }
.deploy-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.deploy-table th, .deploy-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #eef0f5; }
.deploy-table th { color: #9aa0b4; font-weight: 600; }
.deploy-table td:last-child, .deploy-table th:last-child { width: 46px; text-align: center; }
.deploy-table input { width: 16px; height: 16px; accent-color: #4f46e5; }
.deploy-actions { display: flex; gap: 10px; margin-top: 18px; }
#needTable td:first-child { width: 84px; color: #1c1f2b; font-weight: 600; white-space: nowrap; }
#needTable td:last-child { width: auto; text-align: left; }
#needTable .need-opts label { display: inline-flex; align-items: center; gap: 3px; margin: 2px 14px 2px 0; font-size: 13px; cursor: pointer; }
#needTable .deploy-input { width: 100%; box-sizing: border-box; border: 1px solid #e3e6ef; border-radius: 8px; padding: 7px 10px; font: inherit; font-size: 13px; }
#needTable .deploy-input:focus { outline: 2px solid #4f46e5; outline-offset: 0; border-color: transparent; }
#needTable textarea.deploy-input { resize: vertical; }
.deploy-actions .btn.solid { flex: 1; background: #4f46e5; }
.deploy-actions .btn.ghost { flex: 0 0 auto; background: #eef2ff; color: #4f46e5; border: 1px solid #c7d2fe; }
.btn.ai-entry { background: linear-gradient(135deg,#7c3aed,#4f46e5); color: #fff; border: none; box-shadow: 0 2px 8px rgba(79,70,229,.35); }
.btn.ai-entry:hover { filter: brightness(1.05); }
