:root {
  --blue: #1a5fd0;
  --blue-dark: #14479c;
  --blue-soft: #e8f0fd;
  --ink: #1f2933;
  --ink-2: #5a6472;
  --ink-3: #94a3b8;
  --line: #e6ebf2;
  --bg: #f4f6fa;
  --radius: 12px;
}

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

body {
  font-family: "PingFang SC", "Hiragino Sans GB", -apple-system, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 13px;
  height: 100vh;
  overflow: hidden;
}

/* ---------------- 顶栏 ---------------- */
.topbar {
  height: 60px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo {
  width: 40px; height: 40px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
}
.logo img {
  width: 100%; height: 100%; object-fit: contain;
  -webkit-user-drag: none; user-select: none;
}
.brand-name { font-weight: 800; font-size: 15px; letter-spacing: .3px; }
.list-toggle {
  margin-left: 10px; width: 26px; height: 26px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink-2); cursor: pointer;
  font-size: 14px; line-height: 1; padding: 0;
  transition: all .14s ease;
}
.list-toggle:hover { border-color: #c9d8f2; background: #f7f9fc; color: var(--blue-dark); }
.list-toggle .chev { display: block; transition: transform .18s ease; }
.list-toggle.collapsed .chev { transform: rotate(180deg); }
.brand-sub { font-size: 11px; color: var(--ink-3); margin-top: 1px; }

.btn {
  font-family: inherit; font-size: 12.5px; cursor: pointer;
  border-radius: 9px; padding: 8px 14px; border: 1px solid transparent;
  transition: all .16s ease; white-space: nowrap;
}
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-dark); }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--ink-2); }
.btn.ghost:hover { border-color: #c8d4e6; color: var(--ink); background: #f8fafd; }
.btn.ghost.danger:hover { color: #c0392b; border-color: #f0c8c2; background: #fff6f5; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------------- 布局 ---------------- */
.layout {
  height: calc(100vh - 60px);
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  transition: grid-template-columns .18s ease;
}
.layout.list-hidden { grid-template-columns: 0 minmax(0, 1fr); }

/* ---------------- 列表 ---------------- */
.list-pane {
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  min-height: 0; min-width: 0; overflow: hidden;
  transition: opacity .18s ease;
}
.layout.list-hidden .list-pane { opacity: 0; pointer-events: none; border-right: 0; }
.list-head {
  padding: 16px 18px 10px;
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 700; font-size: 13.5px;
}
.count {
  font-size: 11px; font-weight: 600; color: var(--blue);
  background: var(--blue-soft); border-radius: 999px; padding: 2px 8px;
}
.search-box { padding: 0 14px 10px; }
.search-box input {
  width: 100%; font-family: inherit; font-size: 12.5px;
  padding: 8px 11px; border-radius: 9px; border: 1px solid var(--line);
  background: #f7f9fc; color: var(--ink); outline: none;
}
.search-box input:focus { border-color: #b8cdf2; background: #fff; }

.resume-list { flex: 1; overflow-y: auto; padding: 4px 12px 20px; }
.r-card {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 8px; cursor: pointer;
  transition: all .14s ease; background: #fff;
}
.r-card:hover { border-color: #c9d8f2; background: #fbfcff; }
.r-card.active { border-color: var(--blue); background: var(--blue-soft); }
.r-card-top { display: flex; align-items: center; gap: 9px; }
.r-avatar {
  width: 30px; height: 30px; border-radius: 8px; overflow: hidden;
  background: linear-gradient(135deg, #dbe7fb, #c3d6f5);
  color: var(--blue-dark); font-weight: 800; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 30px;
}
.r-avatar img { width: 100%; height: 100%; object-fit: cover; }
.r-name { font-weight: 700; font-size: 13px; line-height: 1.4; }
.r-title {
  font-size: 11px; color: var(--ink-2); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 180px;
}
.r-meta { font-size: 10.5px; color: var(--ink-3); margin-top: 6px; display: flex; gap: 8px; }

/* ---------------- 编辑区 ---------------- */
.editor-pane { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.empty-state {
  margin: auto; text-align: center; color: var(--ink-3);
}
.empty-emoji { font-size: 40px; margin-bottom: 10px; opacity: .8; }

.editor-wrap { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.hidden { display: none !important; }

.editor-toolbar {
  height: 54px; flex: 0 0 54px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; gap: 12px;
  background: #fff; border-bottom: 1px solid var(--line);
}
.tb-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.doc-title {
  font-family: inherit; font-size: 13.5px; font-weight: 700;
  border: 1px solid transparent; background: transparent; color: var(--ink);
  padding: 6px 8px; border-radius: 8px; outline: none; width: 220px;
}
.doc-title:hover { border-color: var(--line); }
.doc-title:focus { border-color: #b8cdf2; background: #fff; }
.save-state { font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.page-hint {
  font-size: 10.5px; color: #b7791f; background: #fdf5e3;
  border: 1px solid #f0dfb8; border-radius: 6px; padding: 2px 7px; white-space: nowrap;
}
.page-hint.hidden { display: none; }
.save-state.saving { color: #b7791f; }
.save-state.saved { color: #2e7d5b; }
.save-state.dirty { color: #8a94a3; }
.save-state.fail { color: #c0392b; }
.tb-right { display: flex; gap: 8px; }

.editor-body { flex: 1; display: grid; grid-template-columns: 400px minmax(0, 1fr); min-height: 0; position: relative; }

.form-pane {
  border-right: 1px solid var(--line);
  background: #fff;
  overflow-y: auto;
  padding: 16px 16px 60px;
}

/* ---- 表单 ---- */
.group { margin-bottom: 22px; }
.group-head {
  display: flex; align-items: baseline; gap: 8px;
  padding-bottom: 8px; margin-bottom: 12px;
  border-bottom: 1px dashed var(--line);
}
.group-title { font-size: 12.5px; font-weight: 800; color: var(--blue-dark); letter-spacing: .3px; }
.group-desc { font-size: 10.5px; color: var(--ink-3); }

.field { margin-bottom: 12px; }
.field label {
  display: block; font-size: 11.5px; color: var(--ink-2);
  margin-bottom: 5px; font-weight: 500;
}
.field input[type=text], .field textarea {
  width: 100%; font-family: inherit; font-size: 12.5px; color: var(--ink);
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fbfcfe; outline: none; resize: vertical; line-height: 1.6;
}
.field input[type=text]:focus, .field textarea:focus {
  border-color: #a9c3ee; background: #fff; box-shadow: 0 0 0 3px rgba(26,95,208,.08);
}
.field textarea::placeholder, .field input::placeholder { color: #b6c0cd; }

/* 列表编辑 */
.list-box { display: flex; flex-direction: column; gap: 10px; }
.list-item {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 10px 4px; background: #fbfcff; position: relative;
}
.list-item-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.idx { font-size: 10.5px; font-weight: 700; color: var(--blue); background: var(--blue-soft); padding: 2px 8px; border-radius: 999px; }
.mini-btn {
  font-family: inherit; font-size: 10.5px; cursor: pointer;
  border: none; background: transparent; color: var(--ink-3);
  padding: 3px 6px; border-radius: 6px;
}
.mini-btn:hover { color: #c0392b; background: #fff0ee; }
.add-btn {
  font-family: inherit; font-size: 11.5px; cursor: pointer;
  border: 1px dashed #c4d3ea; background: #f7faff; color: var(--blue);
  padding: 8px; border-radius: 9px; width: 100%;
}
.add-btn:hover { background: var(--blue-soft); border-color: #a9c3ee; }

/* 头像 */
.photo-row { display: flex; align-items: center; gap: 12px; }
.photo-thumb {
  width: 56px; height: 70px; border-radius: 8px; overflow: hidden;
  background: #eef2f8; display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--ink-3); flex: 0 0 56px;
  border: 1px solid var(--line);
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-actions { display: flex; flex-direction: column; gap: 6px; }
.file-label {
  font-size: 11.5px; color: var(--blue); cursor: pointer;
  border: 1px solid #cfe0f8; background: var(--blue-soft);
  padding: 6px 10px; border-radius: 8px; text-align: center;
}
.file-label:hover { background: #ddebfd; }

/* ---------------- 预览 ---------------- */
.preview-pane {
  background: #f4f6fa; overflow: auto;          /* 放大后可横向、纵向滚动看局部 */
  padding: 24px 24px 32px; min-width: 0;
}
.preview-stage {
  margin: 0 auto;
  position: relative; width: 0; /* 由 JS 按缩放后的尺寸撑开，避免 210mm 把整页撑宽 */
  overflow: hidden; background: #fff;
  border: 1px solid #e6ebf2;
}
.page-guides { position: absolute; left: 0; top: 0; width: 100%; pointer-events: none; }
.page-cut {
  position: absolute; left: 0; right: 0; height: 0;
  border-top: 1px dashed #9aa8bb;
  background: linear-gradient(to bottom, rgba(226,232,240,.9) 0 1px, transparent 1px);
}
.page-cut span {
  position: absolute; right: 6px; top: 2px;
  font-size: 10px; color: #7c8798; letter-spacing: .5px;
  background: #f3f6fb; padding: 1px 6px; border-radius: 4px;
}
.preview-stage iframe { border: 0; background: #fff; display: block; width: 210mm; height: 297mm; }



/* 版式选择（结构变体） */
.lt-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.lt-btn {
  display: grid; grid-template-columns: 28px minmax(0, 1fr); grid-template-rows: auto auto;
  column-gap: 8px; row-gap: 1px; align-items: start;
  padding: 8px 9px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; cursor: pointer; text-align: left; font-family: inherit;
  transition: all .14s ease;
}
.lt-btn:hover { border-color: #c9d8f2; background: #fbfcff; }
.lt-btn.active { border-color: #b8cdf2; background: var(--blue-soft); }
.lt-btn .lt-svg { grid-row: span 2; align-self: center; display: block; }
.lt-btn .lt-name { font-size: 12px; font-weight: 600; color: var(--ink); line-height: 1.4; }
.lt-btn .lt-desc { font-size: 10.5px; color: var(--ink-3); line-height: 1.35; }

/* 侧栏分页 */
.list-pager {
  flex: 0 0 auto;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px;
  padding: 8px 12px 10px;
  border-top: 1px solid var(--line);
  background: #fff; font-size: 11.5px; color: var(--ink-2);
}
.list-pager .pg-size { display: flex; gap: 4px; }
.list-pager button {
  font-family: inherit; font-size: 11.5px; line-height: 1;
  padding: 5px 8px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
}
.list-pager button:hover:not(:disabled) { border-color: #c9d8f2; background: #f7f9fc; }
.list-pager button.active { border-color: #b8cdf2; background: var(--blue-soft); color: var(--blue-dark); }
.list-pager button:disabled { opacity: .45; cursor: default; }
.list-pager .pg-info { flex: 1 1 auto; text-align: center; white-space: nowrap; }
.list-pager .pg-nav { display: flex; gap: 4px; }

/* 时间段：年月选择 */
.mr-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
  align-items: center; gap: 6px;
}
.mr-row input[type="month"] {
  font-family: inherit; font-size: 12.5px; color: var(--ink);
  padding: 7px 8px; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; min-width: 0;
}
.mr-row input[type="month"]:disabled { background: #f4f6fa; color: var(--ink-3); }
.mr-row .mr-sep { color: var(--ink-3); font-size: 12px; }
.mr-row .mr-now { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-2); white-space: nowrap; }

/* ---------------- 滚动条 ---------------- */
/* 列表 / 编辑 / 预览三栏都不画滚动轨道：内容照常可滚，界面上不再出现灰条 */
.resume-list, .form-pane, .preview-pane {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.resume-list::-webkit-scrollbar,
.form-pane::-webkit-scrollbar,
.preview-pane::-webkit-scrollbar { width: 0 !important; height: 0 !important; }

/* 预览缩放控件（固定在预览区右下角，不随纸张滚动） */
.zoom-bar {
  position: absolute; right: 26px; bottom: 18px; z-index: 5;
  display: flex; align-items: center; gap: 2px; padding: 3px;
  background: rgba(255, 255, 255, .95); border: 1px solid #e2e8f0; border-radius: 999px;
  box-shadow: 0 6px 16px rgba(16, 24, 40, .10);
}
.zoom-bar button {
  width: 26px; height: 26px; border: 0; border-radius: 999px; background: transparent;
  color: #334155; font-size: 14px; line-height: 1; cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center; transition: background .12s ease;
}
.zoom-bar button:hover { background: #eef3fb; }
.zoom-bar .zoom-val {
  width: auto; padding: 0 9px; font-size: 11.5px; font-weight: 600; color: #64748b;
  min-width: 46px;
}
.zoom-bar .zoom-val.on { color: #1a5fd0; }

/* ---------------- toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%) translateY(14px);
  background: #111827; color: #fff; font-size: 12.5px;
  padding: 10px 18px; border-radius: 10px; opacity: 0; pointer-events: none;
  transition: all .22s ease; z-index: 99; box-shadow: 0 10px 24px rgba(0,0,0,.2);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------------- 窄屏 ---------------- */
@media (max-width: 1180px) {
  .editor-body { grid-template-columns: 360px minmax(0, 1fr); }
}

/* ---------------- 版式与出版 ---------------- */
.group-layout { border-bottom: 1px solid #e6ebf2; }

.tpl-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.tpl-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 11px 7px 9px; border-radius: 9px; cursor: pointer;
  border: 1px solid #dfe6ef; background: #fff; color: #33414f;
  font-size: 12.5px; font-family: inherit; transition: all .16s;
}
.tpl-btn:hover { border-color: #b9c7da; }
.tpl-btn.active { border-color: #1a5fd0; background: #f3f8ff; color: #12489e; font-weight: 600; box-shadow: 0 0 0 2px rgba(26,95,208,.08); }
.tpl-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.tpl-swatch { width: 14px; height: 14px; border-radius: 4px; border: 1px solid; flex: none; }

.wm-row { display: flex; align-items: center; gap: 11px; margin-bottom: 6px; }
.wm-text {
  flex: 1 1 auto; min-width: 0; height: 32px; padding: 0 10px;
  border: 1px solid #dfe6ef; border-radius: 8px; font-size: 12.5px;
  font-family: inherit; color: #24313f; background: #fff;
}
.wm-text:disabled { background: #f6f8fa; color: #98a2b0; cursor: not-allowed; }
.wm-text:focus { outline: none; border-color: #1a5fd0; box-shadow: 0 0 0 3px rgba(26,95,208,.1); }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  width: 38px; height: 21px; border-radius: 999px; background: #d7dfe9;
  position: relative; transition: background .18s;
}
.switch .knob {
  position: absolute; top: 2.5px; left: 2.5px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(16,24,40,.25); transition: left .18s;
}
.switch input:checked + .track { background: #1a5fd0; }
.switch input:checked + .track .knob { left: 19.5px; }
.switch-text { font-size: 12.5px; color: #33414f; }

.field-hint { font-size: 11.5px; color: #7b8794; line-height: 1.6; }

/* ---------------- 富文本工具条 ---------------- */
.rich-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: -2px 0 6px; }
.rich-btn {
  border: 1px solid #dfe6ef; background: #fff; color: #33414f; cursor: pointer;
  border-radius: 7px; padding: 3px 8px; font-size: 11.5px; font-family: inherit; line-height: 1.6;
}
.rich-btn:hover { border-color: #b9c7da; background: #f7f9fc; }
.rich-b { font-weight: 800; }
.rich-mark { color: #7a5b00; }
.rich-tip { font-size: 11px; color: #8a95a3; }

/* ---------------- 选项按钮（页脚对齐等） ---------------- */
.opt-row { display: flex; flex-wrap: wrap; gap: 8px; }
.opt-btn {
  border: 1px solid #dfe6ef; background: #fff; color: #33414f; cursor: pointer;
  border-radius: 8px; padding: 6px 12px; font-size: 12.5px; font-family: inherit;
}
.opt-btn:hover { border-color: #b9c7da; }
.opt-btn.active { border-color: #1a5fd0; background: #f3f8ff; color: #12489e; font-weight: 600; }

/* 表单里的开关：覆盖 .field label 的 display:block，否则轨道会被压成零宽导致文字重叠 */
.field-switch { margin: 2px 0 12px; }
.field .switch { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-weight: 400; }
.field .switch .track { display: inline-block; flex: 0 0 auto; }
.field .switch .switch-text { font-size: 12.5px; color: var(--ink-2); line-height: 21px; }
