* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: #f5f5f5;
  color: #333;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container, #app {
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: 40px;
}

.loading {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

.error-page {
  text-align: center;
  padding: 60px 20px;
  color: #ff4d4f;
}

.wechat-tip {
  background: #fffbe6;
  border: 1px solid #ffe58f;
  color: #d48806;
  padding: 12px 16px;
  margin: 12px 16px 0;
  border-radius: 8px;
  font-size: 14px;
  text-align: center;
}

.image-field .image-input {
  width: 100%;
  padding: 8px 0;
  font-size: 14px;
}

.image-field .image-preview {
  margin-top: 8px;
}

.image-field .image-preview img {
  max-width: 100%;
  max-height: 150px;
  border-radius: 6px;
  border: 1px solid #f0f0f0;
}

.rich-editor {
  width: 100%;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  background: #fff;
}

.rich-toolbar {
  display: flex;
  gap: 6px;
  padding: 6px;
  border-bottom: 1px solid #f0f0f0;
  background: #fafafa;
  border-radius: 6px 6px 0 0;
}

.rich-toolbar button {
  width: 32px;
  height: 28px;
  border: 1px solid #d9d9d9;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}

.rich-toolbar button:hover {
  border-color: #07c160;
  color: #07c160;
}

.rich-content {
  min-height: 80px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.5;
  outline: none;
}

.rich-content:empty:before {
  content: attr(placeholder);
  color: #bfbfbf;
}

.required-mark {
  color: #ff4d4f;
  margin-left: 4px;
}

/* 头部Banner */
.banner {
  width: 100%;
  overflow: hidden;
}

.banner img {
  width: 100%;
  height: auto;
  display: block;
  min-height: 120px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* 标题区 */
.header {
  background: #fff;
  padding: 20px 16px 16px;
  text-align: center;
  border-bottom: 1px solid #f0f0f0;
}

.header h1 {
  font-size: 22px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 10px;
}

.subtitle {
  font-size: 14px;
  color: #666;
  line-height: 1.6;
  padding: 0 16px 16px;
  text-align: left;
}

.subtitle img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin-top: 8px;
}

.subtitle b, .subtitle strong {
  color: #1a1a1a;
}

.subtitle u {
  text-decoration: underline;
}

/* 表单卡片 */
.form-card {
  background: #fff;
  margin: 12px 16px;
  padding: 20px 16px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 15px;
  font-weight: 500;
  color: #1a1a1a;
  margin-bottom: 8px;
}

/* 输入框 */
input[type="text"],
input[type="tel"],
input[type="number"],
select.form-input,
textarea.form-input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid #d9d9d9;
  border-radius: 8px;
  font-size: 15px;
  color: #333;
  background: #fff;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}

textarea.form-input {
  padding: 10px 12px;
  resize: vertical;
}

input[type="text"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
select.form-input:focus,
textarea.form-input:focus {
  outline: none;
  border-color: #07c160;
}

input::placeholder {
  color: #bfbfbf;
}

/* 单选按钮组 */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.radio-item {
  flex: 1 1 calc(33.33% - 7px);
  min-width: 80px;
}

.radio-item input,
.checkbox-item input,
.course-card input,
.item-card input {
  display: none;
}

.radio-item span,
.checkbox-item span {
  display: block;
  padding: 10px 8px;
  text-align: center;
  border: 1px solid #d9d9d9;
  border-radius: 8px;
  font-size: 14px;
  color: #333;
  cursor: pointer;
  transition: all 0.2s;
}

.checkbox-item {
  flex: 1 1 calc(50% - 5px);
  min-width: 100px;
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.radio-item input:checked + span,
.checkbox-item input:checked + span {
  background: #e6f7ed;
  border-color: #07c160;
  color: #07c160;
  font-weight: 500;
}

/* 课程/项目选择卡片 */
.course-options,
.item-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.course-card,
.item-card {
  display: block;
  border: 1px solid #d9d9d9;
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.course-card:hover,
.item-card:hover {
  border-color: #b3b3b3;
}

.course-card:has(input:checked),
.item-card:has(input:checked) {
  border-color: #07c160;
  background: #e6f7ed;
}

.course-info,
.item-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.course-name,
.item-name {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
}

.course-date,
.item-desc {
  font-size: 14px;
  color: #666;
  flex: 1;
  text-align: center;
  margin: 0 8px;
}

.course-price,
.item-price {
  font-size: 18px;
  font-weight: 700;
  color: #ff4d4f;
}

.course-card:has(input:checked) .course-name,
.course-card:has(input:checked) .course-date,
.item-card:has(input:checked) .item-name,
.item-card:has(input:checked) .item-desc {
  color: #07c160;
}

.course-card:has(input:checked) .course-price,
.item-card:has(input:checked) .item-price {
  color: #ff6b6b;
}

/* 金额条 */
.amount-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  margin-top: 8px;
  border-top: 1px dashed #e8e8e8;
  font-size: 15px;
  color: #666;
}

.amount {
  font-size: 24px;
  font-weight: 700;
  color: #ff4d4f;
}

/* 提交按钮 */
.submit-btn {
  width: 100%;
  height: 48px;
  background: #07c160;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 17px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 8px;
}

.submit-btn:active {
  background: #06ad56;
}

.submit-btn:disabled {
  background: #b3e6c8;
  cursor: not-allowed;
}

/* 底部 */
.footer {
  text-align: center;
  padding: 20px;
  font-size: 12px;
  color: #999;
}

/* 加载遮罩 */
.mask {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  color: #fff;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 错误提示 */
.error-msg {
  color: #ff4d4f;
  font-size: 13px;
  margin-top: 4px;
}

input.error {
  border-color: #ff4d4f !important;
}

/* ========== 管理后台样式 ========== */
.admin-body {
  background: #f0f2f5;
}

.admin-header {
  background: #fff;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 900px;
  margin: 0 auto;
}

.admin-header h1 {
  font-size: 18px;
}

.admin-nav {
  display: flex;
  gap: 8px;
}

.admin-nav button {
  padding: 6px 14px;
  border: 1px solid #d9d9d9;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
}

.admin-nav button.active {
  background: #07c160;
  color: #fff;
  border-color: #07c160;
}

.admin-container {
  max-width: 900px;
  margin: 16px auto;
  padding: 0 16px 40px;
}

.admin-card {
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.admin-card h3 {
  font-size: 16px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f0f0f0;
}

.admin-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.admin-btn-primary {
  background: #07c160;
  color: #fff;
}

.admin-btn-danger {
  background: #ff4d4f;
  color: #fff;
}

.admin-btn-default {
  background: #fff;
  border: 1px solid #d9d9d9;
  color: #333;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid #f0f0f0;
}

.admin-table th {
  color: #666;
  font-weight: 500;
  background: #fafafa;
}

.admin-form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.admin-form-row label {
  min-width: 80px;
  padding-top: 8px;
  font-size: 14px;
  color: #666;
}

.admin-form-row input,
.admin-form-row select {
  flex: 1;
  min-width: 120px;
  padding: 8px 10px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  font-size: 14px;
}

.admin-form-row .small {
  flex: 0 0 80px;
}

.admin-section {
  margin-bottom: 20px;
}

.admin-section-title {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-list-item {
  background: #fafafa;
  border: 1px solid #f0f0f0;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 10px;
}

.admin-banner-preview {
  max-width: 200px;
  max-height: 120px;
  margin-top: 8px;
  border-radius: 4px;
}

.admin-status-PENDING { color: #faad14; }
.admin-status-PAID { color: #07c160; }
.admin-status-FREE { color: #1890ff; }

.hidden { display: none !important; }

/* ========== 可视化编辑器样式 ========== */
.builder-layout {
  display: flex;
  gap: 16px;
  margin-top: 16px;
}

.builder-left {
  width: 160px;
  flex-shrink: 0;
}

.builder-left h4 {
  font-size: 14px;
  color: #333;
  margin-bottom: 8px;
}

.builder-hint {
  font-size: 12px;
  color: #999;
  margin-bottom: 8px;
}

.palette-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.palette-item {
  background: #fff;
  border: 1px dashed #b3b3b3;
  border-radius: 6px;
  padding: 10px;
  font-size: 13px;
  color: #555;
  cursor: grab;
  text-align: center;
  transition: all 0.2s;
}

.palette-item:hover {
  border-color: #07c160;
  color: #07c160;
}

.palette-item.sortable-ghost {
  opacity: 0.3;
}

.builder-middle {
  flex: 1;
  min-width: 0;
}

.builder-middle h4 {
  font-size: 14px;
  color: #333;
  margin-bottom: 8px;
}

.sortable-list {
  min-height: 60px;
  background: #fafafa;
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  padding: 8px;
}

.empty-tip {
  text-align: center;
  color: #999;
  font-size: 13px;
  padding: 20px 0;
}

.preview-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.preview-item:hover {
  border-color: #07c160;
}

.preview-item.selected {
  border-color: #07c160;
  background: #e6f7ed;
}

.preview-drag {
  color: #999;
  cursor: grab;
  font-size: 16px;
}

.preview-info {
  flex: 1;
  min-width: 0;
}

.preview-label {
  font-size: 14px;
  font-weight: 500;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-type {
  font-size: 12px;
  color: #888;
  margin-top: 2px;
}

.builder-right {
  width: 240px;
  flex-shrink: 0;
  background: #fafafa;
  border-radius: 6px;
  padding: 12px;
}

.builder-right h4 {
  font-size: 14px;
  color: #333;
  margin-bottom: 10px;
}

.prop-placeholder {
  color: #999;
  font-size: 13px;
  line-height: 1.6;
}

@media (max-width: 768px) {
  .builder-layout {
    flex-direction: column;
  }

  .builder-left,
  .builder-right {
    width: 100%;
  }

  .palette-list {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .palette-item {
    flex: 1 1 calc(50% - 4px);
  }
}

  .admin-header,
  .admin-container {
    max-width: 100%;
  }

  .admin-table {
    font-size: 12px;
  }

  .admin-table th,
  .admin-table td {
    padding: 8px 4px;
  }

  .admin-form-row {
    flex-direction: column;
    gap: 6px;
  }

  .admin-form-row label {
    padding-top: 0;
  }

  .admin-form-row input,
  .admin-form-row select {
    width: 100%;
  }
}
