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

:root {
  --primary: #4f6ef7;
  --primary-dark: #3d5ae0;
  --bg: #f4f6fb;
  --card-bg: #ffffff;
  --text: #1f2430;
  --text-light: #7a8299;
  --border: #e6e9f2;
  --danger: #e5484d;
  --success: #30a46c;
  --warn: #f5a623;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

.hidden { display: none !important; }

/* ==================== 登录页 ==================== */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #4f6ef7 0%, #7a5cf0 100%);
}
.login-card {
  background: #fff;
  padding: 40px 36px;
  border-radius: 16px;
  width: 360px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  text-align: center;
}
.login-card h1 { font-size: 22px; margin-bottom: 8px; }
.login-tip { color: var(--text-light); margin-bottom: 24px; }
.login-card input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 16px;
  outline: none;
}
.login-card input:focus { border-color: var(--primary); }

/* ==================== 按钮 ==================== */
.btn {
  padding: 9px 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: all .15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-group { display: flex; gap: 10px; margin-top: 12px; }

/* ==================== 布局 ==================== */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: #1e2235;
  color: #c9cede;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.logo {
  padding: 22px 20px;
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.nav-item {
  display: block;
  width: 100%;
  padding: 13px 20px;
  background: none;
  border: none;
  color: #c9cede;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background .15s;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.logout {
  margin-top: auto;
  padding: 14px 20px;
  background: none;
  border: none;
  border-top: 1px solid rgba(255,255,255,.08);
  color: #8b93ab;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.logout:hover { color: var(--danger); }

.main { flex: 1; padding: 28px 32px; overflow-x: auto; }
.page { display: none; }
.page.active { display: block; }
.page h2 { margin-bottom: 20px; font-size: 20px; }

/* ==================== 卡片 / 表单 ==================== */
.card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(31,36,48,.05);
}
.card h3 { margin-bottom: 14px; font-size: 15px; }
.hint { color: var(--text-light); font-size: 13px; margin-bottom: 18px; line-height: 1.7; }
.hint code {
  background: #eef1fa;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  word-break: break-all;
}
.form-row { margin-bottom: 16px; }
.form-row label { display: block; margin-bottom: 6px; font-weight: 500; }
.form-row input[type="text"],
.form-row input[type="number"],
.form-row textarea {
  width: 100%;
  max-width: 480px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
}
.form-row input:focus, .form-row textarea:focus { border-color: var(--primary); }
.switch-wrap { display: flex; align-items: center; gap: 10px; }
.switch { width: 40px; height: 22px; appearance: none; background: #cfd4e3; border-radius: 11px; position: relative; cursor: pointer; outline: none; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: left .2s; }
.switch:checked { background: var(--success); }
.switch:checked::after { left: 20px; }

/* ==================== 统计卡片 ==================== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
}
.stat-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 2px 10px rgba(31,36,48,.05);
}
.stat-card.highlight { background: linear-gradient(135deg, #4f6ef7, #7a5cf0); color: #fff; }
.stat-card.highlight .stat-label { color: rgba(255,255,255,.8); }
.stat-num { font-size: 28px; font-weight: 700; margin-bottom: 6px; }
.stat-label { color: var(--text-light); font-size: 13px; }

/* ==================== 表格 ==================== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; white-space: nowrap; }
th { color: var(--text-light); font-weight: 500; background: #f8f9fd; }
td code { background: #eef1fa; padding: 2px 6px; border-radius: 4px; font-size: 12px; }

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
}
.tag-paid { background: #e3f5ec; color: var(--success); }
.tag-created { background: #fdf3e0; color: var(--warn); }

.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar select, .toolbar input {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  background: #fff;
}
.toolbar input { min-width: 260px; }

.pager { display: flex; align-items: center; gap: 14px; margin-top: 16px; justify-content: flex-end; }
.pager span { color: var(--text-light); font-size: 13px; }

/* ==================== 16 人格资料 ==================== */
.muted { color: #9aa1b5; font-size: 12px; }

.type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.type-cell {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
  background: #fafbfe;
}
.type-cell:hover { border-color: var(--primary); box-shadow: 0 4px 14px rgba(79,110,247,.15); }
.type-cell-code { font-size: 20px; font-weight: 700; color: var(--primary); letter-spacing: 2px; }
.type-cell-name { font-size: 14px; font-weight: 500; margin: 6px 0 8px; }
.type-cell-tags { font-size: 11px; color: var(--text-light); }

/* ==================== Toast ==================== */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 11px 22px;
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  z-index: 999;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  animation: slideIn .25s;
}
.toast.ok { background: var(--success); }
.toast.err { background: var(--danger); }
@keyframes slideIn { from { opacity: 0; transform: translateX(-50%) translateY(-12px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ==================== 页面布局 / 界面美化 ==================== */
.layout-groups { display: flex; flex-direction: column; gap: 22px; }
.layout-group-body {
  display: grid;
  grid-template-columns: 276px 1fr;
  gap: 18px;
  align-items: start;
}
.layout-preview { position: sticky; top: 16px; }
.preview-title { font-size: 12px; color: var(--text-light); margin-bottom: 8px; }
.preview-note { font-size: 12px; color: #9aa1b4; margin-top: 8px; line-height: 1.5; }

/* ===== 手机线框示意图 ===== */
.ph {
  width: 260px;
  min-height: 480px;
  border: 1px solid #d9deef;
  border-radius: 20px;
  background-color: #fff;
  background-size: cover;
  background-position: top center;
  background-repeat: no-repeat;
  padding: 10px;
  position: relative;
  box-shadow: 0 6px 18px rgba(31, 36, 48, .08);
}
.ph-topbar { display: flex; align-items: center; justify-content: space-between; height: 26px; margin-bottom: 8px; }
.ph-txt { font-size: 10px; color: #8b93a7; }
.ph-bar { flex: 1; height: 4px; border-radius: 2px; background: #eceffa; margin: 0 6px; }
.ph-region {
  border: 1px dashed #b9c2dc;
  border-radius: 8px;
  background-color: #f7f9ff;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: #98a1b8;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  transition: outline-color .15s;
}
.ph-region.ph-filled { border-style: solid; border-color: #cfd7ea; }
.ph-region.hl { outline: 3px solid var(--primary); outline-offset: 1px; }
.ph-logo { width: 78px; height: 22px; }
.ph-hero {
  height: 94px;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
  padding: 4px;
}
.ph-hero b { font-size: 12px; color: #3d4658; }
.ph-hero em { font-size: 9px; font-style: normal; color: #7a8299; }
.ph-hero--sm { height: 78px; }
.ph-card { border: 1px solid #eaeefb; border-radius: 10px; padding: 8px; margin-bottom: 8px; }
.ph-card--row { display: flex; align-items: center; gap: 8px; }
.ph-plan { height: 54px; flex: 1; }
.ph-cover { width: 46px; height: 46px; flex-shrink: 0; }
.ph-cover--2 { opacity: .85; }
.ph-hero-sq { width: 56px; height: 56px; flex-shrink: 0; }
.ph-report-hero { height: 118px; margin-bottom: 10px; }
.ph-lines { flex: 1; display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.ph-card--row .ph-lines { margin-top: 0; }
.ph-lines i { display: block; height: 6px; border-radius: 3px; background: #eef1fb; }
.ph-lines i.w40 { width: 40%; }
.ph-lines i.w50 { width: 50%; }
.ph-lines i.w60 { width: 60%; }
.ph-lines i.w70 { width: 70%; }
.ph-lines i.w80 { width: 80%; }
.ph-lines--center { align-items: center; }
.ph-stub {
  border-radius: 8px;
  background: #f4f6fd;
  color: #98a1b8;
  font-size: 10px;
  padding: 10px 8px;
  text-align: center;
  margin: 8px 0;
}
.ph-q { font-size: 10px; color: #4a5468; background: #f7f9ff; border-radius: 8px; padding: 8px; margin-bottom: 6px; line-height: 1.4; }
.ph-opt { font-size: 10px; color: #5a6478; border: 1px solid #eaeefb; border-radius: 8px; padding: 6px 8px; margin-bottom: 6px; }
.ph-btn { background: var(--primary); color: #fff; text-align: center; border-radius: 8px; font-size: 11px; padding: 8px; }
.ph-bg-badge {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 2;
  display: block;
  width: auto;
  height: auto;
  padding: 3px 8px;
  border-radius: 6px;
  background-color: #fff9e6;
  border-color: #f0d79a;
  color: #a37b1a;
}
.ph-tag {
  position: absolute;
  left: 4px;
  top: 4px;
  z-index: 2;
  font-size: 9px;
  line-height: 1.6;
  padding: 0 5px;
  border-radius: 4px;
  background: #eef2ff;
  color: #5a6a9a;
}
.ph-avatar-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ph-avatar { height: 46px; }

.layout-card.hl { box-shadow: 0 0 0 2px var(--primary); border-color: var(--primary); }

/* AI 解读：示例预览框 */
.ai-preview-box {
  margin-top: 16px;
  padding: 16px 18px;
  border-radius: 10px;
  background: #f5f8ff;
  border: 1px solid var(--border);
  color: #2f3b46;
  font-size: 13px;
  line-height: 1.9;
  white-space: pre-wrap;
}

/* 多图位置（可上传多张，异步随机显示） */
.multi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}
.multi-item {
  position: relative;
  height: 76px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #f8f9fd;
}
.multi-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.multi-del {
  position: absolute;
  right: 2px;
  top: 2px;
  width: 20px;
  height: 20px;
  line-height: 1;
  border: none;
  border-radius: 50%;
  background: rgba(31, 36, 48, .62);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}
.multi-del:hover { background: var(--danger); }
.multi-tag {
  font-size: 11px;
  font-weight: 400;
  color: #5a6a9a;
  background: #eef2ff;
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 4px;
}
.layout-card--multi .layout-thumb { height: 76px; }

.ph-random { height: 54px; margin-bottom: 8px; }
.ph-secimg { width: 62px; height: 40px; flex-shrink: 0; }
.ph-count {
  position: absolute;
  right: 3px;
  top: 3px;
  font-size: 9px;
  line-height: 1.6;
  padding: 0 4px;
  border-radius: 4px;
  background: #eef2ff;
  color: #5a6a9a;
}
.layout-group-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}
.layout-group-head h3 { font-size: 16px; }
.layout-group-desc { color: var(--text-light); font-size: 12px; }
.layout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}
.layout-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.layout-thumb {
  height: 132px;
  border-radius: 8px;
  border: 1px dashed var(--border);
  background: #f8f9fd;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.layout-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.layout-thumb--empty { color: #b3b9c9; font-size: 12px; }
.layout-meta { flex: 1; }
.layout-label { font-weight: 600; margin-bottom: 4px; }
.layout-tip { color: var(--text-light); font-size: 12px; line-height: 1.5; }
.layout-size { color: #9aa1b4; font-size: 12px; margin-top: 4px; }
.layout-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.layout-actions .btn { text-decoration: none; }

/* 响应式 */
@media (max-width: 768px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; }
  .main { padding: 18px; }
}

@media (max-width: 1100px) {
  .layout-group-body { grid-template-columns: 1fr; }
  .layout-preview { position: static; }
  .ph { width: 100%; max-width: 320px; }
}
