:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-alt: #f2f6ff;
  --line: #e9edf5;
  --text: #1f2a37;
  --muted: #6b7280;
  --brand: #3a6ff0;
  --brand-soft: #edf3ff;
  --danger: #eb5757;
  --shadow: 0 12px 28px rgba(28, 42, 67, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}

button, input, textarea {
  font: inherit;
}

button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  transition: all 0.2s ease;
}

button:hover { border-color: var(--brand); color: var(--brand); }
button.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}
button.primary:hover { background: #295ce0; color: white; }
button.danger {
  border-color: rgba(235, 87, 87, 0.25);
  color: var(--danger);
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 310px;
  height: 100vh;
}
.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 18px 16px;
}
.right-panel {
  border-right: none;
  border-left: 1px solid var(--line);
}

.brand-block {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line);
}
.brand-mark {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), #7aa4ff); color: #fff; font-weight: 700; font-size: 20px;
}
.brand-block h1 { margin: 0; font-size: 22px; }
.brand-block p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

.panel-group { margin-bottom: 20px; }
.panel-group h3 {
  margin: 0 0 10px; font-size: 14px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase;
}
.template-list, .component-list { display: grid; gap: 8px; }
.template-item {
  width: 100%; text-align: left; background: var(--panel-alt); border-color: transparent;
}
.template-item.active {
  background: var(--brand-soft); border-color: var(--brand); color: var(--brand);
}
.component-list button { width: 100%; text-align: left; }

.editor-panel { display: flex; flex-direction: column; min-width: 0; }
.toolbar {
  display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 12px;
  background: rgba(255,255,255,.75); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px);
}
.toolbar-left { display: flex; gap: 10px; flex-wrap: wrap; }
.canvas-wrap {
  flex: 1; display: grid; place-items: center; padding: 24px; overflow: auto;
}
.phone-frame {
  width: 100%; max-width: 420px; min-height: 780px; background: #e9eef8; border: 1px solid var(--line);
  border-radius: 24px; padding: 18px 18px 10px; box-shadow: var(--shadow);
}
.article-shell { background: #fff; border-radius: 18px; min-height: 100%; padding: 18px 18px 30px; }
.article-stack { display: flex; flex-direction: column; gap: 12px; }
.article-header { margin-bottom: 18px; }
.article-title {
  margin: 0 0 8px; font-size: 30px; line-height: 1.3; font-weight: 700;
}
.article-subtitle { margin: 0; font-size: 14px; line-height: 1.7; color: var(--muted); }
.article-subtitle.caption { margin-top: 8px; font-size: 12px; color: var(--muted); }
.article-block {
  position: relative; margin: 0; padding: 8px 8px 10px; border-radius: 12px; border: 1px solid transparent; transition: all 0.2s ease;
}
.article-block.selected {
  border-color: var(--brand); background: rgba(58,111,240,0.03);
}
.drag-handle {
  position: absolute; right: 10px; top: 8px; color: var(--muted); cursor: grab; font-weight: 700; user-select: none;
}
.article-text { margin: 0; font-size: 16px; line-height: 1.8; color: var(--text); }
.article-image {
  width: 100%; border-radius: 14px; display: block; margin: 8px 0 2px; background: #e6edf8; min-height: 180px; object-fit: cover;
}
.article-quote {
  background: var(--brand-soft); border-left: 4px solid var(--brand); border-radius: 12px; padding: 14px 16px; color: var(--text); font-size: 15px; line-height: 1.7;
}
.article-list { margin: 0; padding-left: 22px; line-height: 1.9; color: var(--text); }
.article-cta {
  margin-top: 12px; background: linear-gradient(135deg, var(--brand), #5d8bff); color: #fff; border-radius: 14px; padding: 16px 18px; text-align: center; font-weight: 600; font-size: 16px;
}
.input-field, textarea, select {
  width: 100%; border: 1px solid var(--line); background: white; border-radius: 10px; padding: 9px 10px; margin-top: 6px; color: var(--text);
}
textarea { min-height: 90px; resize: vertical; }
.export-panel textarea { min-height: 200px; }
.empty-state { color: var(--muted); font-size: 13px; line-height: 1.7; }
.property-actions { display: flex; gap: 8px; margin-top: 14px; }
.property-actions button { flex: 1; }
.global-toast {
  position: fixed; right: 24px; bottom: 24px; background: rgba(31,42,55,.92); color: white; padding: 10px 14px; border-radius: 999px; font-size: 13px; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); transition: all 0.2s ease; pointer-events: none;
}
.global-toast.show { opacity: 1; transform: translateY(0); }
