/* ===== 茧历品牌色（取自 logo）：科技蓝 #10479D + 青绿 #17A0B2，白底清爽 ===== */
:root {
  --blue: #10479d;
  --blue-2: #1e63c0;
  --teal: #17a0b2;
  --teal-dark: #0e7c8c;
  --blue-light: #eaf1fa;
  --teal-light: #e7f6f7;
  --ink: #1f2937;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f4f8fc;
  --card: #ffffff;
  --danger: #c0392b;
  --grad: linear-gradient(120deg, var(--blue) 0%, var(--teal) 100%);
}

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

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}

/* ===== Header（白底 + logo） ===== */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 10px 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 8px rgba(16, 71, 157, .06);
}
.header-inner {
  max-width: 1520px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { height: 40px; display: block; }
.brand-text h1 { font-size: 17px; font-weight: 700; color: var(--blue); }
.domain-tag {
  font-size: 11px;
  background: var(--teal-light);
  border: 1px solid var(--teal);
  color: var(--teal-dark);
  border-radius: 4px;
  padding: 1px 8px;
  margin-left: 8px;
  font-weight: 500;
  vertical-align: middle;
}
.brand-text p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.header-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.user-chip {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--blue);
  background: var(--blue-light);
  padding: 6px 12px; border-radius: 20px;
}
.user-chip button { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 12px; }
.user-chip button:hover { color: var(--danger); }

/* ===== Buttons ===== */
.btn {
  border: none;
  border-radius: 6px;
  padding: 9px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s ease;
  font-family: inherit;
}
.btn-primary { background: var(--grad); color: #fff; font-weight: 700; }
.btn-primary:hover { opacity: .9; }
.btn-outline { background: #fff; color: var(--blue); border: 1px solid var(--blue-2); }
.btn-outline:hover { background: var(--blue-light); }
.btn-ghost { background: #fff; color: var(--muted); border: 1px solid var(--line); }
.btn-ghost:hover { color: var(--blue); border-color: var(--blue-2); }
.btn-add {
  background: var(--teal-light);
  color: var(--teal-dark);
  border: 1px dashed var(--teal);
  width: 100%;
  padding: 10px;
  margin-top: 8px;
}
.btn-add:hover { background: #d8eff1; }
.btn-ai {
  background: var(--grad);
  color: #fff;
  width: 100%;
  margin-top: 10px;
  font-weight: 700;
}
.btn-ai:hover { opacity: .9; }
.btn-ai:disabled { opacity: .5; cursor: wait; }
.btn-ai-sm {
  background: none;
  border: 1px solid var(--teal);
  color: var(--teal-dark);
  border-radius: 4px;
  font-size: 11px;
  padding: 2px 8px;
  cursor: pointer;
  margin-left: 8px;
  font-family: inherit;
}
.btn-ai-sm:hover { background: var(--teal-light); }
.btn-ai-sm:disabled { opacity: .5; cursor: wait; }

/* ===== Layout ===== */
.layout {
  max-width: 1520px;
  margin: 20px auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 480px 1fr;
  gap: 20px;
  align-items: start;
}
.panel {
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 1px 6px rgba(16, 71, 157, .06);
}

/* ===== Form ===== */
.form-panel { padding: 0 0 20px; overflow: hidden; }
.step-tabs {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  background: #fbfdff;
  border-radius: 12px 12px 0 0;
}
.tab {
  flex: 1 1 auto;
  border: none;
  background: none;
  padding: 12px 8px;
  font-size: 13px;
  cursor: pointer;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  font-family: inherit;
}
.tab.active { color: var(--blue); font-weight: 700; border-bottom-color: var(--teal); }
.tab:hover { color: var(--blue); }

.step { display: none; padding: 20px 22px 0; border: none; }
.step.active { display: block; }
.step legend {
  font-size: 16px;
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 14px;
  padding: 0;
}
.legend-hint { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 8px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label {
  display: block;
  font-size: 13px;
  color: #374151;
  margin-bottom: 12px;
  font-weight: 500;
}
input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue-2);
  box-shadow: 0 0 0 3px rgba(30, 99, 192, .08);
}
textarea { resize: vertical; line-height: 1.6; }
.field-tip { font-size: 12px; color: var(--muted); margin: -6px 0 12px; }
.photo-upload input[type="file"] { padding: 7px; }
.photo-tip { font-size: 12px; color: var(--muted); margin-left: 6px; }

/* dynamic entries */
.entry {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
  background: #fbfdff;
  position: relative;
}
.entry-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.entry-head strong { font-size: 13px; color: var(--blue); }
.entry-del { border: none; background: none; color: var(--danger); cursor: pointer; font-size: 12px; }
.entry-del:hover { text-decoration: underline; }

/* ===== Score card ===== */
.preview-panel { padding: 18px; }
.score-card {
  display: flex;
  gap: 16px;
  background: linear-gradient(120deg, var(--blue-light), #fff);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.score-left { text-align: center; min-width: 74px; }
.score-num { font-size: 34px; font-weight: 800; color: var(--blue); line-height: 1.1; }
.score-label { font-size: 12px; color: var(--muted); }
.score-body { flex: 1; }
.score-bar { height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; margin-bottom: 10px; }
.score-bar-fill {
  height: 100%;
  width: 0;
  background: var(--grad);
  transition: width .4s ease;
}
.opt-list { list-style: none; font-size: 12.5px; color: #475569; max-height: 130px; overflow-y: auto; }
.opt-list li { padding: 3px 0 3px 18px; position: relative; line-height: 1.5; }
.opt-list li::before { content: "•"; position: absolute; left: 4px; color: var(--teal); font-weight: 700; }
.opt-list li.ok::before { content: "✓"; color: var(--teal-dark); }
.opt-list li.ai::before { content: "◆"; color: var(--blue-2); }

/* ===== Preview ===== */
.preview-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
  gap: 8px;
}
.tpl-switch { display: flex; gap: 6px; flex-wrap: wrap; }
.tpl-btn {
  border: 1px solid var(--line);
  background: #fff;
  padding: 5px 12px;
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
  color: var(--muted);
  font-family: inherit;
}
.tpl-btn.active { border-color: var(--blue); color: var(--blue); font-weight: 700; background: var(--blue-light); }
.edit-toggle { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.edit-toggle input { width: auto; margin: 0; }

.preview-scroll {
  overflow: auto;
  max-height: calc(100vh - 300px);
  border-radius: 8px;
  background: #e8eef5;
  padding: 18px;
  display: flex;
  justify-content: center;
}
.edit-mode-banner {
  display: none;
  background: #fff8e6;
  border: 1px solid #f0d98c;
  color: #8a6d1a;
  font-size: 12px;
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 12px;
}
.edit-mode-banner.show { display: block; }

/* ===== Resume A4 通用 ===== */
.resume {
  width: 794px;
  min-height: 1123px;
  background: #fff;
  box-shadow: 0 4px 24px rgba(16, 71, 157, .12);
  color: #222;
  flex-shrink: 0;
  transform-origin: top center;
}
.resume[contenteditable="true"] { outline: 2px dashed var(--teal); outline-offset: -2px; }

/* ---------- 模板一：学术蓝（参考图1：深蓝节目标签 + 居中头 + 右侧照片） ---------- */
.tpl-academic { padding: 44px 50px; font-family: "SimSun", "Songti SC", serif; }
.tpl-academic .r-header { text-align: center; position: relative; padding-bottom: 14px; border-bottom: 2px solid var(--blue); }
.tpl-academic .r-name { font-size: 28px; letter-spacing: 8px; color: var(--blue); font-family: "SimHei", "Microsoft YaHei", sans-serif; }
.tpl-academic .r-contact { font-size: 12.5px; color: #444; margin-top: 8px; line-height: 1.9; }
.tpl-academic .r-target { font-size: 13px; color: var(--teal-dark); font-weight: 700; margin-top: 4px; }
.tpl-academic .r-photo-wrap { position: absolute; right: 0; top: -6px; }
.r-photo { width: 86px; height: 116px; object-fit: cover; border: 1px solid #d5dce6; }
.r-photo-placeholder {
  width: 86px; height: 116px; border: 1px dashed #b6c3d6;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: #98a5b8;
}
.tpl-academic .r-section { margin-top: 16px; }
.tpl-academic .r-section-title {
  display: inline-block;
  background: var(--blue);
  color: #fff;
  font-size: 13.5px;
  font-family: "SimHei", "Microsoft YaHei", sans-serif;
  letter-spacing: 3px;
  padding: 4px 18px 4px 12px;
  border-radius: 0 14px 14px 0;
  margin-bottom: 10px;
}
.tpl-academic .r-section-title::before { content: "◈ "; font-size: 12px; }

/* ---------- 模板二：菁英蓝（参考图3：左上图标方块 + 全宽分隔线） ---------- */
.tpl-elite { padding: 46px 52px; font-family: "SimSun", "Songti SC", serif; }
.tpl-elite .r-header { display: flex; justify-content: space-between; align-items: flex-start; padding-bottom: 14px; border-bottom: 3px solid var(--blue); }
.tpl-elite .r-name { font-size: 30px; letter-spacing: 6px; color: var(--blue); font-family: "SimHei", "Microsoft YaHei", sans-serif; }
.tpl-elite .r-contact { font-size: 12.5px; color: #444; margin-top: 8px; line-height: 1.9; }
.tpl-elite .r-target { font-size: 13px; color: var(--teal-dark); font-weight: 700; margin-top: 4px; }
.tpl-elite .r-section { margin-top: 18px; }
.tpl-elite .r-section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 700; color: var(--blue);
  font-family: "SimHei", "Microsoft YaHei", sans-serif;
  letter-spacing: 3px;
  border-bottom: 1.5px solid #cfd9e6;
  padding-bottom: 6px;
  margin-bottom: 10px;
}
.tpl-elite .r-section-title::before {
  content: "";
  width: 20px; height: 20px;
  background: var(--grad);
  border-radius: 4px;
  flex-shrink: 0;
}
.tpl-elite .r-award-group { font-size: 13px; line-height: 1.9; }
.tpl-elite .r-award-group b { color: var(--blue); display: inline-block; min-width: 56px; }

/* ---------- 模板三：清雅分栏（左栏信息 + 右栏经历） ---------- */
.tpl-split { display: flex; min-height: 1123px; font-family: "Microsoft YaHei", "PingFang SC", sans-serif; }
.tpl-split .r-side {
  width: 252px;
  background: linear-gradient(180deg, var(--blue) 0%, #0d3d86 70%, var(--teal-dark) 100%);
  color: #fff;
  padding: 40px 24px;
  flex-shrink: 0;
}
.tpl-split .r-side .r-photo, .tpl-split .r-side .r-photo-placeholder { margin: 0 auto 16px; display: block; border-color: rgba(255,255,255,.4); }
.tpl-split .r-side .r-photo-placeholder { color: rgba(255,255,255,.6); border-color: rgba(255,255,255,.4); }
.tpl-split .r-name { font-size: 24px; letter-spacing: 4px; text-align: center; font-weight: 700; }
.tpl-split .r-target { text-align: center; font-size: 12px; color: #9fe8ef; margin-top: 6px; }
.tpl-split .r-side-block { margin-top: 24px; }
.tpl-split .r-side-title {
  font-size: 13px; font-weight: 700; letter-spacing: 2px;
  border-bottom: 1px solid rgba(255,255,255,.35);
  padding-bottom: 5px; margin-bottom: 8px;
}
.tpl-split .r-side-item { font-size: 12px; line-height: 1.9; color: rgba(255,255,255,.92); word-break: break-all; }
.tpl-split .r-main { flex: 1; padding: 40px 34px; }
.tpl-split .r-section { margin-bottom: 18px; }
.tpl-split .r-section-title {
  font-size: 15px; font-weight: 700; color: var(--blue);
  letter-spacing: 2px;
  border-left: 5px solid var(--teal);
  padding-left: 10px;
  margin-bottom: 10px;
}

/* ---------- 三模板共用的条目样式 ---------- */
.r-row { display: flex; justify-content: space-between; font-size: 13px; line-height: 1.7; gap: 12px; }
.r-row strong { font-size: 13.5px; }
.r-row .r-time { color: #555; white-space: nowrap; font-size: 12.5px; }
.r-sub { font-size: 12.5px; color: #444; line-height: 1.75; margin-top: 2px; text-align: justify; }
.r-item { margin-bottom: 10px; }
.r-item .r-role { color: var(--blue-2); font-weight: 700; }
.r-ul { margin: 4px 0 0 18px; font-size: 12.5px; line-height: 1.8; color: #333; list-style: none; }
.r-ul li { margin-bottom: 2px; position: relative; }
.r-ul li::before { content: "➢"; position: absolute; left: -16px; color: var(--teal); font-size: 11px; }
.r-line { font-size: 13px; line-height: 1.8; text-align: justify; }
.r-kv { font-size: 12.5px; line-height: 1.8; }
.r-kv b { color: var(--blue); }

/* ===== 登录/注册弹窗 ===== */
.auth-mask {
  position: fixed; inset: 0;
  background: rgba(16, 35, 66, .45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.auth-mask.show { display: flex; }
.auth-card {
  background: #fff;
  border-radius: 14px;
  width: 380px;
  padding: 32px 32px 28px;
  box-shadow: 0 12px 48px rgba(0,0,0,.2);
}
.auth-card .auth-logo { text-align: center; margin-bottom: 18px; }
.auth-card .auth-logo img { height: 44px; }
.auth-card h2 { font-size: 18px; color: var(--blue); text-align: center; margin-bottom: 4px; }
.auth-card .auth-sub { font-size: 12px; color: var(--muted); text-align: center; margin-bottom: 18px; }
.auth-tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.auth-tabs button {
  flex: 1; border: none; background: none; padding: 10px;
  font-size: 14px; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; font-family: inherit;
}
.auth-tabs button.active { color: var(--blue); font-weight: 700; border-bottom-color: var(--teal); }
.auth-card label { font-size: 13px; }
.auth-card .btn-primary { width: 100%; padding: 11px; margin-top: 6px; }
.auth-err { color: var(--danger); font-size: 12px; min-height: 18px; margin-top: 6px; text-align: center; }
.auth-note { font-size: 11px; color: var(--muted); text-align: center; margin-top: 12px; line-height: 1.6; }

/* ===== 管理后台 ===== */
.admin-wrap { max-width: 1080px; margin: 24px auto; padding: 0 20px; }
.admin-card { background: #fff; border-radius: 12px; padding: 22px 26px; margin-bottom: 20px; box-shadow: 0 1px 6px rgba(16,71,157,.06); }
.admin-card h3 { color: var(--blue); font-size: 16px; margin-bottom: 14px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th, .admin-table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
.admin-table th { color: var(--muted); font-weight: 500; background: #fbfdff; }
.admin-table tr:hover td { background: #fbfdff; }
.tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 10px; }
.tag-green { background: var(--teal-light); color: var(--teal-dark); }
.tag-gray { background: #eef1f5; color: var(--muted); }
.tag-blue { background: var(--blue-light); color: var(--blue); }
.admin-actions { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.admin-actions label { margin-bottom: 0; }
.invite-code { font-family: Consolas, monospace; letter-spacing: 1px; }

/* ===== Footer / Toast ===== */
.site-footer { text-align: center; padding: 20px; font-size: 12px; color: var(--muted); }
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--blue);
  color: #fff;
  padding: 10px 22px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  transition: all .3s ease;
  z-index: 300;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  max-width: 80vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .preview-scroll { max-height: none; }
}
