* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f7fa;
  color: #333;
  line-height: 1.5;
}
.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* 顶栏 */
.top-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 0; border-bottom: 1px solid #e8e8e8; margin-bottom: 24px;
}
.logo { display: flex; align-items: center; gap: 8px; }
.logo-icon {
  width: 32px; height: 32px; background: linear-gradient(135deg,#1890ff,#52c41a);
  color: #fff; border-radius: 6px; display: flex; align-items: center; justify-content: center;
  font-weight: bold; font-size: 18px;
}
.logo-text { font-size: 18px; font-weight: 600; }
.nav { display: flex; gap: 24px; }
.nav a { color: #666; text-decoration: none; font-size: 15px; }
.nav a.active { color: #1890ff; font-weight: 600; }

/* 卡片 */
.card {
  background: #fff; border-radius: 10px; padding: 24px; margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.main { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 860px) { .main { grid-template-columns: 1fr; } }

/* 标签 */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tab {
  padding: 6px 16px; border: 1px solid #d9d9d9; background: #fff;
  border-radius: 6px; cursor: pointer; font-size: 14px; transition: all .2s;
}
.tab:hover { border-color: #1890ff; color: #1890ff; }
.tab.active { background: #1890ff; color: #fff; border-color: #1890ff; }

.notice {
  background: #f0f5ff; border: 1px solid #adc6ff; border-radius: 6px;
  padding: 10px 14px; font-size: 13px; color: #595959; margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.info-icon {
  display: inline-flex; width: 18px; height: 18px; background: #1890ff; color: #fff;
  border-radius: 50%; align-items: center; justify-content: center; font-size: 12px; font-style: italic;
}

textarea {
  width: 100%; min-height: 120px; padding: 12px; border: 1px solid #d9d9d9;
  border-radius: 6px; resize: vertical; font-size: 14px; font-family: inherit;
}
textarea:focus, input:focus, select:focus { outline: none; border-color: #1890ff; }

.form-group { position: relative; margin-bottom: 12px; }
.char-count {
  position: absolute; bottom: 8px; right: 12px; font-size: 12px; color: #999;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid label { display: block; font-size: 13px; color: #666; margin-bottom: 4px; }
.form-grid input, .form-grid select {
  width: 100%; padding: 8px 10px; border: 1px solid #d9d9d9; border-radius: 6px; font-size: 14px;
}

.actions { display: flex; gap: 12px; margin-top: 16px; }
.btn {
  padding: 10px 28px; border: none; border-radius: 6px; cursor: pointer;
  font-size: 15px; font-weight: 500; transition: opacity .2s;
}
.btn:hover { opacity: .85; }
.btn-primary { background: #1890ff; color: #fff; }
.btn-warn { background: #fa8c16; color: #fff; }
.btn-default { background: #f0f0f0; color: #333; }
.btn-sm { padding: 6px 16px; font-size: 13px; }

/* 结果区 */
.result-card { display: flex; flex-direction: column; align-items: center; }
.qr-placeholder { text-align: center; color: #999; }
.qr-demo {
  width: 220px; height: 220px; margin: 0 auto 12px;
  background: linear-gradient(135deg, #e6e6e6 25%, transparent 25%) 0 0 / 20px 20px,
              linear-gradient(-135deg, #e6e6e6 25%, transparent 25%) 0 0 / 20px 20px,
              #fafafa;
  border-radius: 8px;
}
#qrResult img { max-width: 100%; border-radius: 8px; }
.qr-actions { margin-top: 16px; }

.decode-result { width: 100%; margin-top: 16px; }
.decode-result h4 { margin-bottom: 8px; color: #1890ff; }
.decode-result textarea { background: #fafafa; }

.decode-upload { width: 100%; }
.decode-upload h4 { margin-bottom: 12px; color: #fa8c16; }
.upload-box {
  display: block; border: 2px dashed #d9d9d9; border-radius: 8px;
  padding: 40px 20px; text-align: center; cursor: pointer; transition: border-color .2s;
}
.upload-box:hover { border-color: #1890ff; }
.upload-box.dragover { border-color: #1890ff; background: #f0f5ff; }
.upload-icon { font-size: 40px; }
.upload-inner p { margin: 8px 0 4px; color: #666; }
.upload-inner small { color: #999; }

/* 样式面板 */
.style-card details summary { cursor: pointer; font-weight: 600; color: #1890ff; }
.style-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px; margin-top: 16px;
}
.style-item label { display: block; font-size: 13px; color: #666; margin-bottom: 4px; }
.style-item input[type="color"] { width: 100%; height: 34px; border: 1px solid #d9d9d9; border-radius: 6px; cursor: pointer; }
.style-item select, .style-item input[type="text"], .style-item input[type="number"] {
  width: 100%; padding: 6px 8px; border: 1px solid #d9d9d9; border-radius: 6px;
}

/* 模板页 */
.page-title { margin-bottom: 16px; font-size: 20px; }
.search-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; }
.search-bar input {
  flex: 1; max-width: 360px; padding: 8px 12px; border: 1px solid #d9d9d9; border-radius: 6px;
}
.filter-row { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.filter-label { min-width: 48px; font-size: 14px; color: #666; padding-top: 6px; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 5px 14px; border: 1px solid #d9d9d9; background: #fff;
  border-radius: 16px; cursor: pointer; font-size: 13px; transition: all .2s;
}
.chip:hover { border-color: #1890ff; color: #1890ff; }
.chip.active { background: #1890ff; color: #fff; border-color: #1890ff; }

.template-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px; margin-top: 20px;
}
.tpl-card {
  background: #fff; border: 1px solid #eee; border-radius: 10px; overflow: hidden;
  cursor: pointer; transition: transform .2s, box-shadow .2s; display: flex; flex-direction: column;
}
.tpl-card:hover { transform: translateY(-4px); box-shadow: 0 6px 20px rgba(0,0,0,.1); }
.tpl-card .cover {
  width: 100%; aspect-ratio: 3/4; background: #f0f0f0; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.tpl-card .cover img { width: 100%; height: 100%; object-fit: cover; }
.tpl-card .cover .no-img { color: #bbb; font-size: 13px; }
.tpl-card .info { padding: 10px 12px; }
.tpl-card .info h4 { font-size: 14px; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpl-card .info p { font-size: 12px; color: #999; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tpl-card .stats { display: flex; gap: 12px; font-size: 11px; color: #bbb; margin-top: 6px; }
.new-card {
  border: 2px dashed #d9d9d9; display: flex; flex-direction: column;
  align-items: center; justify-content: center; color: #999; background: #fafafa;
  aspect-ratio: auto; min-height: 280px;
}
.new-card .new-icon { font-size: 48px; color: #1890ff; margin-bottom: 8px; }

.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 24px; }
.pagination button {
  min-width: 34px; height: 34px; border: 1px solid #d9d9d9; background: #fff;
  border-radius: 6px; cursor: pointer;
}
.pagination button.active { background: #1890ff; color: #fff; border-color: #1890ff; }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }

/* 弹窗 */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-content {
  background: #fff; border-radius: 10px; width: 100%; max-width: 640px;
  max-height: 90vh; overflow-y: auto;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid #eee; }
.modal-header .close { font-size: 24px; cursor: pointer; color: #999; }
.modal-body { padding: 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid #eee; display: flex; justify-content: flex-end; gap: 8px; }

.detail-item { margin-bottom: 16px; }
.detail-item label { display: block; font-size: 13px; color: #666; margin-bottom: 4px; }
.detail-item input, .detail-item textarea, .detail-item select {
  width: 100%; padding: 8px 10px; border: 1px solid #d9d9d9; border-radius: 6px;
}
.item-row {
  display: flex; gap: 8px; align-items: center; margin-bottom: 8px;
  padding: 10px; background: #fafafa; border-radius: 6px;
}
.item-row select { flex: 1; padding: 6px; border: 1px solid #d9d9d9; border-radius: 4px; }
.item-row textarea { flex: 2; padding: 6px; border: 1px solid #d9d9d9; border-radius: 4px; min-height: 36px; }
.item-row button { padding: 6px 10px; border: 1px solid #ff4d4f; color: #ff4d4f; background: #fff; border-radius: 4px; cursor: pointer; }

/* ==================== 生码助手扩展 ==================== */
/* 名片下拉 */
.tab-dropdown { position: relative; }
.tab-dropdown-menu {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; z-index: 50;
  background: #fff; border: 1px solid #e8e8e8; border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0,0,0,.12); min-width: 120px; overflow: hidden;
}
.tab-dropdown:hover .tab-dropdown-menu { display: block; }
.tab-dropdown-item {
  padding: 8px 16px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.tab-dropdown-item:hover { background: #f0f5ff; color: #1890ff; }
.tab-form { background: #fff0f6; border-color: #ffadd2; color: #eb2f96; }
.tab-form.active, .tab-form:hover { background: #eb2f96; border-color: #eb2f96; color: #fff; }

/* 多文件上传 */
.multi-upload {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; border: 2px dashed #d9d9d9; border-radius: 8px; padding: 28px;
  cursor: pointer; color: #999; transition: border-color .2s;
}
.multi-upload:hover { border-color: #1890ff; color: #1890ff; }
.mu-icon { font-size: 34px; }
.multi-upload small { color: #bbb; }
.file-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.file-tag {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  background: #fafafa; border: 1px solid #eee; border-radius: 6px; max-width: 280px;
}
.file-tag.uploading { background: #f0f5ff; border-color: #adc6ff; }
.file-tag.error { background: #fff1f0; border-color: #ffa39e; }
.ft-thumb { width: 34px; height: 34px; object-fit: cover; border-radius: 4px; }
.ft-ico { font-size: 20px; }
.ft-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ft-status { font-size: 12px; color: #1890ff; white-space: nowrap; }
.error .ft-status { color: #ff4d4f; }
.ft-del { color: #ff4d4f; cursor: pointer; font-size: 16px; padding: 0 4px; }

/* 表单独享入口 */
.form-entry { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 680px) { .form-entry { grid-template-columns: 1fr; } }
.entry-card {
  border: 1px solid #e8e8e8; border-radius: 10px; padding: 26px 22px; cursor: pointer;
  text-align: center; transition: all .2s; background: #fafafa;
}
.entry-card:hover { border-color: #1890ff; box-shadow: 0 6px 18px rgba(24,144,255,.12); transform: translateY(-2px); }
.entry-icon { font-size: 40px; margin-bottom: 8px; }
.entry-card h3 { font-size: 17px; margin-bottom: 8px; }
.entry-card p { font-size: 13px; color: #888; margin-bottom: 14px; }
.entry-btn { color: #1890ff; font-size: 14px; font-weight: 500; }
.form-tpl { margin-top: 24px; }
.form-tpl > h4 { font-size: 15px; margin-bottom: 12px; }
.tpl-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px;
}
.ftpl-card {
  border: 1px solid #e8e8e8; border-radius: 8px; padding: 14px; cursor: pointer;
  transition: all .2s; background: #fff;
}
.ftpl-card:hover { border-color: #eb2f96; box-shadow: 0 4px 14px rgba(235,47,150,.1); }
.ftpl-card h5 { font-size: 14px; margin-bottom: 4px; }
.ftpl-card p { font-size: 12px; color: #999; margin-bottom: 10px; }
.ftpl-fields { display: flex; flex-wrap: wrap; gap: 4px; }
.ftpl-fields span {
  font-size: 11px; padding: 2px 8px; background: #f5f5f5; border-radius: 10px; color: #666;
}

/* 数据表格（表单管理） */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td {
  padding: 10px 12px; border-bottom: 1px solid #f0f0f0; text-align: left;
}
.data-table th { background: #fafafa; font-weight: 600; color: #595959; white-space: nowrap; }
.action-btns { white-space: nowrap; }
.btn-link {
  background: none; border: none; color: #1890ff; cursor: pointer; padding: 4px 8px;
  font-size: 13px; text-decoration: none; display: inline-block;
}
.btn-link:hover { text-decoration: underline; }
.btn-link.btn-danger { color: #ff4d4f; }
