:root {
  --primary: #2563eb;
  --primary-2: #06b6d4;
  --grad: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
  --grad-soft: linear-gradient(135deg, rgba(37, 99, 235, 0.10), rgba(6, 182, 212, 0.10));
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --card: #ffffff;
  --line: #e6ebf4;
  --soft: #f1f5fb;
  --bg: #eef2f8;
  --ok: #059669;
  --ok-soft: #e6f7f0;
  --danger: #e11d48;
  --danger-soft: #fdeef2;
  --warn: #b45309;
  --warn-soft: #fff7e8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 28px rgba(15, 23, 42, 0.07);
  --shadow-hover: 0 4px 10px rgba(15, 23, 42, 0.06), 0 18px 44px rgba(15, 23, 42, 0.12);
}

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

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: linear-gradient(180deg, #f6f9ff 0%, #edf2f9 100%);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(720px at 88% -8%, rgba(6, 182, 212, 0.14), transparent 62%),
    radial-gradient(820px at -8% 108%, rgba(37, 99, 235, 0.10), transparent 62%);
}

::selection { background: rgba(37, 99, 235, 0.18); }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; border: 2px solid transparent; background-clip: content-box; }

.hidden { display: none !important; }

/* ---------------- 登录页 ---------------- */
#login-view {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
  background: linear-gradient(135deg, #0b2a6b 0%, #14449e 42%, #0e7fc4 100%);
}

#login-view::before {
  content: "";
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(103, 232, 249, 0.34), transparent 65%);
  top: -160px;
  right: -120px;
  animation: floatA 14s ease-in-out infinite;
}

#login-view::after {
  content: "";
  position: absolute;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(129, 140, 248, 0.32), transparent 65%);
  bottom: -170px;
  left: -110px;
  animation: floatB 18s ease-in-out infinite;
}

@keyframes floatA {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-36px, 42px) scale(1.08); }
}

@keyframes floatB {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(44px, -36px) scale(1.06); }
}

.login-card {
  position: relative;
  z-index: 2;
  width: 430px;
  max-width: 100%;
  background: rgba(255, 255, 255, 0.93);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 20px;
  padding: 36px 38px 30px;
  box-shadow: 0 30px 80px rgba(3, 16, 50, 0.38);
  animation: rise 0.5s cubic-bezier(0.2, 0.8, 0.3, 1);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-brand {
  text-align: center;
  margin-bottom: 24px;
}

.login-brand .logo {
  width: 62px;
  height: 62px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background: var(--grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  color: #fff;
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.35);
}

.login-brand .title {
  font-size: 21px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.5px;
}

.login-brand .sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  letter-spacing: 2px;
}

.login-card .tabs {
  display: flex;
  background: #eef2f9;
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 22px;
}

.login-card .tab-btn {
  flex: 1;
  padding: 9px 0;
  border: none;
  border-radius: 9px;
  background: transparent;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.18s ease;
}

.login-card .tab-btn.active {
  background: #fff;
  color: var(--primary);
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.10);
}

.login-card input {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 13px;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  font-size: 14px;
  background: #fff;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-card input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.login-card .primary-btn {
  width: 100%;
  margin-top: 4px;
  padding: 13px;
  font-size: 15px;
  border-radius: 11px;
}

.login-note {
  margin-top: 14px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  line-height: 1.7;
}

.login-note b { color: var(--primary); }

.form-msg { margin-top: 10px; font-size: 13px; color: var(--danger); min-height: 18px; text-align: center; }
.form-msg.ok { color: var(--ok); }

/* ---------------- 布局 ---------------- */
#app {
  position: relative;
  z-index: 1;
}

.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: 236px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid rgba(230, 235, 244, 0.9);
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px 18px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.28);
  flex-shrink: 0;
}

.brand-name { font-size: 16px; font-weight: 700; color: var(--ink); letter-spacing: 0.3px; }
.brand-sub { font-size: 11px; color: var(--muted); margin-top: 1px; letter-spacing: 1.5px; }

.sidebar nav {
  flex: 1;
  padding: 10px 12px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  margin-bottom: 5px;
  border: none;
  border-radius: 11px;
  background: transparent;
  color: var(--ink-2);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.16s ease;
}

.nav-btn .nav-ico { font-size: 16px; line-height: 1; }

.nav-btn:hover { background: rgba(37, 99, 235, 0.07); color: var(--primary); }
.nav-btn.active {
  background: var(--grad);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.30);
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
}

.user-name { font-weight: 600; color: var(--ink); font-size: 14px; }
.user-role { font-size: 12px; color: var(--muted); margin-top: 2px; }

.logout-btn {
  margin-top: 10px;
  width: 100%;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.16s ease;
}

.logout-btn:hover { border-color: #f3b8c6; color: var(--danger); background: var(--danger-soft); }

main {
  margin-left: 236px;
  min-height: 100vh;
  padding: 30px 34px 60px;
}

.page { max-width: 1200px; margin: 0 auto; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

.page-head h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.3px;
}

.page-head h1::after {
  content: "";
  display: block;
  width: 46px;
  height: 4px;
  margin-top: 8px;
  border-radius: 3px;
  background: var(--grad);
}

.page-head p { color: var(--muted); margin-top: 8px; font-size: 13px; }

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  animation: rise 0.35s ease;
}

.card h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 12px;
  padding-left: 13px;
  position: relative;
}

.card h3::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 3px;
  width: 4px;
  border-radius: 3px;
  background: var(--grad);
}

.hint { color: var(--muted); font-size: 13px; margin-bottom: 12px; line-height: 1.7; }
.empty { color: var(--muted); text-align: center; padding: 32px 0; }

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  padding: 36px;
}

.loading::before {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid #dbe4f3;
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}

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

/* ---------------- 按钮 ---------------- */
.primary-btn {
  background: var(--grad);
  color: #fff;
  border: none;
  border-radius: 11px;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.24);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.primary-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(37, 99, 235, 0.32); }
.primary-btn:active { transform: translateY(0); }
.primary-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }

.soft-btn {
  background: #fff;
  color: var(--primary);
  border: 1px solid #d4e0f5;
  border-radius: 11px;
  padding: 10px 17px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.soft-btn:hover { background: #f2f6ff; border-color: #b8ccf0; }

.mini-btn {
  background: #fff;
  color: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 6px 12px;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.mini-btn:hover { border-color: #b8ccf0; color: var(--primary); background: #f4f8ff; }
.mini-btn.danger { color: var(--danger); border-color: #f6cdd7; background: #fff; }
.mini-btn.danger:hover { background: var(--danger-soft); border-color: #f0aab9; }
.mini-btn.accent { color: var(--ok); border-color: #b8e6d3; background: #fff; }
.mini-btn.accent:hover { background: var(--ok-soft); border-color: #8fd6b8; }
.mini-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 13px;
  margin-bottom: 10px;
  padding: 0;
  transition: opacity 0.14s ease;
}

.link-btn:hover { opacity: 0.75; }

/* ---------------- 表单 ---------------- */
input[type=text], input[type=password], input[type=file], select, textarea {
  border: 1.5px solid #cbd5e1;
  border-radius: 11px;
  padding: 11px 13px;
  font-size: 14px;
  outline: none;
  background: #f8fafc;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:hover, select:hover, textarea:hover { border-color: #94a3b8; }
input::placeholder, textarea::placeholder { color: #94a3b8; opacity: 1; }

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.10);
}

textarea { width: 100%; resize: vertical; line-height: 1.75; }

.form-grid, .settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}

.form-grid .full, .settings-grid .full { grid-column: 1 / -1; }

.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 6px;
}

.field input, .field select, .field textarea { width: 100%; }

/* ---------------- 项目卡片 ---------------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }

.project-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px 16px;
  box-shadow: var(--shadow);
  border-left: 4px solid transparent;
  background-image: linear-gradient(#fff, #fff), var(--grad);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.project-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }

.project-card .card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.project-card h3 { font-size: 16px; font-weight: 700; color: var(--ink); margin: 0; padding: 0; }
.project-card h3::before { display: none; }

.status-pill {
  font-size: 11.5px;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
  background: var(--soft);
  color: var(--muted);
}

.status-pill.published { background: var(--ok-soft); color: var(--ok); }
.status-pill.draft { background: #eef4ff; color: var(--primary); }

.project-card .meta { color: var(--muted); font-size: 12.5px; line-height: 1.9; margin-top: 4px; }
.progress { margin-top: 12px; height: 6px; background: #e9eef7; border-radius: 4px; overflow: hidden; }
.progress > div { height: 100%; background: var(--grad); border-radius: 4px; transition: width 0.4s ease; }

/* ---------------- 项目详情 ---------------- */
.project-tabs {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 20px;
  background: #fff;
  border: 1px solid var(--line);
  padding: 5px;
  border-radius: 13px;
  box-shadow: var(--shadow);
}

.project-tabs .tab-btn {
  border: none;
  background: none;
  padding: 10px 18px;
  border-radius: 9px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.16s ease;
}

.project-tabs .tab-btn:hover { color: var(--primary); }
.project-tabs .tab-btn.active {
  background: var(--grad);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.26);
}

.upload-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.upload-row select { width: 178px; }
.upload-row textarea { flex: 1; min-width: 260px; font-size: 13px; color: var(--ink-2); }
#upload-status { color: var(--muted); font-size: 13px; min-height: 20px; }

/* 待上传文件清单（每个文件单独类型/背景/删除） */
.upload-actions { display: flex; align-items: center; gap: 12px; margin: 4px 0 10px; flex-wrap: wrap; }
.prep-row { border: 1px solid #dfe7f3; border-radius: 12px; background: #f8fbff; padding: 10px 12px; margin-bottom: 10px; }
.prep-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.prep-name { font-weight: 600; color: var(--ink); font-size: 13.5px; flex: 1; min-width: 180px; }
.prep-cat { width: 190px; padding: 8px 10px; }
.prep-note { width: 100%; margin-top: 10px; font-size: 13px; }
.prep-del { margin-left: auto; }
.mini-btn.file-del { color: var(--danger); border-color: #f6cdd7; background: #fff; }

/* ---------------- 表格 ---------------- */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  padding: 10px 12px;
  background: #f8fafd;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #eef2f8;
  font-size: 13px;
  vertical-align: top;
}

.data-table tbody tr { transition: background 0.12s ease; }
.data-table tbody tr:hover td { background: #f8fbff; }
.data-table tbody tr:last-child td { border-bottom: none; }

.fname { max-width: 270px; word-break: break-all; }
.mini-link { font-size: 12px; color: var(--primary); margin-left: 8px; text-decoration: none; }
.mini-link:hover { text-decoration: underline; }
.text-row td { background: #f6f9fe !important; }
.file-text pre {
  background: #f6f9fe;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  font-size: 12.5px;
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.7;
}

/* ---------------- 生成 ---------------- */
.gen-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.quota-badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 13px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: #eaf2ff;
  color: var(--primary);
  border: 1px solid #d7e4fb;
}
.gen-log {
  background: linear-gradient(160deg, #0d1b30 0%, #10233f 100%);
  color: #c7dcf5;
  border-radius: 12px;
  padding: 14px 16px;
  max-height: 230px;
  overflow: auto;
  font-size: 13px;
  line-height: 1.9;
  margin-top: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 10px 24px rgba(13, 27, 48, 0.16);
  font-family: "SFMono-Regular", Consolas, "Courier New", monospace;
}

.gen-log .log-line.err { color: #ff9c94; }
.gen-log:empty { display: none; }

.section-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.section-card:hover { border-color: #d5e0f3; box-shadow: var(--shadow); }

/* 资料不足板块：红色提示 */
.section-card.need-input-card { border-color: #f0aab9; background: #fffbfc; }
.chip.need-input { background: var(--danger-soft); color: var(--danger); border: 1px solid #f0aab9; }
.need-input-warn {
  background: var(--danger-soft);
  border: 1px solid #f0aab9;
  color: var(--danger);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 12px;
  line-height: 1.7;
}
.ai-note-warn {
  background: #fffbeb;
  border: 1px solid #f3dcae;
  color: #b45309;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13px;
  margin-bottom: 12px;
  line-height: 1.7;
}

/* 格式自检结果 */
.fmt-ok {
  background: var(--ok-soft);
  border: 1px solid #b8e6d3;
  color: var(--ok);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
}
.fmt-issues {
  background: #fffbeb;
  border: 1px solid #f3dcae;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: #92400e;
}
.fmt-issues ul { margin: 8px 0 2px 18px; padding: 0; line-height: 1.8; }
.fmt-issues li.fmt-error { color: var(--danger); font-weight: 600; }
.fmt-issues li.fmt-warn { color: #92400e; }

/* 板块联动同步提示（前面板块改动影响后面板块） */
.sync-warn {
  background: #fff7ed;
  border: 1.5px solid #fdba74;
  color: #c2410c;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 12px;
  line-height: 1.7;
  box-shadow: 0 0 0 3px rgba(253, 186, 116, 0.18);
}
.sync-warn button { font-size: 13px; }

/* 板块总览 */
.ov-summary { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; font-size: 13.5px; font-weight: 700; }
.ov-ok { color: var(--ok); }
.ov-need { color: var(--danger); }
.ov-total { color: var(--muted); font-weight: 600; }
.ov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.ov-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
  text-align: left;
  font-size: 12.5px;
}
.ov-item:hover { border-color: #94a3b8; box-shadow: 0 2px 8px rgba(15,23,42,.06); }
.ov-idx {
  font-size: 11px;
  font-weight: 800;
  color: var(--primary);
  background: #eef4ff;
  border-radius: 6px;
  padding: 1px 6px;
  flex-shrink: 0;
  font-family: "SFMono-Regular", Consolas, monospace;
}
.ov-title { flex: 1; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-badge { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 8px; flex-shrink: 0; }
.ov-ok .ov-badge { background: var(--ok-soft); color: var(--ok); }
.ov-warn .ov-badge { background: #fff7ed; color: #c2410c; }
.ov-danger .ov-badge { background: var(--danger-soft); color: var(--danger); }
.ov-empty .ov-badge { background: #eef1f6; color: var(--muted); }
.ov-warn { border-color: #fdba74; }
.ov-danger { border-color: #f0aab9; background: #fffbfc; }
.ov-chapter { border-style: dashed; border-color: #c7d2fe; background: #fafbff; }
.ov-chapter .ov-badge { background: #eef2ff; color: #4f46e5; }
.ov-arrow { color: #4f46e5; font-size: 10px; flex-shrink: 0; }

/* 板块补充背景输入框 */
.user-note-row { margin: 10px 0 4px; }
.user-note-row label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; font-weight: 600; }
.user-note-row textarea { width: 100%; font-size: 13px; }

/* 大框套小框：章节容器嵌套子板块 */
.sec-chapter {
  border: 1.5px dashed #b8c4f5;
  border-radius: 14px;
  background: #fbfcff;
  padding: 12px 14px;
  margin-bottom: 16px;
}
.sec-chapter-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed #d5ddfb;
  flex-wrap: wrap;
}
.sec-chapter-head .sec-title { font-size: 15px; }
.sec-chapter-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-left: 6px;
}
.sec-chapter-body .sec-chapter { margin-bottom: 0; }
.sec-chapter-body .section-card { margin-bottom: 0; }

.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.sec-title { font-weight: 700; color: var(--ink); font-size: 14.5px; }

.sec-num {
  font-size: 12px;
  font-weight: 800;
  color: var(--primary);
  background: #eef4ff;
  border: 1px solid #d7e4fb;
  border-radius: 8px;
  padding: 2px 8px;
  letter-spacing: 1px;
  font-family: "SFMono-Regular", Consolas, monospace;
}

/* 项目详情：模板信息分行展示 */
.project-meta { margin-top: 8px; display: flex; flex-direction: column; gap: 7px; }
.meta-line { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.meta-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: #eef1f6;
  border-radius: 6px;
  padding: 2px 8px;
}
.meta-value { font-weight: 600; color: var(--ink); font-size: 14px; }
.meta-chips { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }

.chip {
  background: #eaf2ff;
  color: var(--primary);
  border-radius: 20px;
  padding: 3px 11px;
  font-size: 12px;
  font-weight: 500;
}

.chip.gray { background: #eef1f6; color: var(--muted); }
.chip.warn { background: var(--warn-soft); color: var(--warn); border: 1px solid #f3dcae; }
.chip.ai { background: #eef2ff; color: #4f46e5; border: 1px solid #c7d2fe; }

.sec-actions { margin-top: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sec-msg { color: var(--ok); font-size: 12.5px; }

/* ---------------- 预览 ---------------- */
.preview-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.preview-head h3 { margin-bottom: 6px; }
.preview-frame {
  width: 100%;
  height: 78vh;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
}

.warn {
  background: var(--warn-soft);
  border: 1px solid #f3dcae;
  color: var(--warn);
  border-radius: 11px;
  padding: 11px 15px;
  margin-top: 14px;
  font-size: 13px;
  line-height: 1.8;
}

.fb-content pre {
  background: #f7f9fd;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 320px;
  overflow: auto;
  line-height: 1.9;
}

.fb-btns { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.fb-input { margin-top: 10px; display: flex; gap: 8px; }
.fb-input input { flex: 1; }
.fb-msg { margin-top: 10px; font-size: 13px; color: var(--primary); min-height: 18px; font-weight: 500; }
.fb-history { margin-top: 12px; font-size: 12px; color: var(--muted); background: #f8fafd; border-radius: 10px; padding: 10px 14px; }
.fb-history ul { margin: 6px 0 0 18px; }
.fb-history li { margin-bottom: 4px; line-height: 1.7; }

/* ---------------- 弹窗 ---------------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(9, 20, 45, 0.48);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 54px 16px;
  overflow: auto;
  z-index: 100;
}

.modal {
  background: #fff;
  border-radius: 18px;
  padding: 26px 28px;
  width: 740px;
  max-width: 100%;
  box-shadow: 0 28px 80px rgba(4, 16, 45, 0.35);
  animation: rise 0.3s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.modal h3 { margin-bottom: 18px; color: var(--ink); font-size: 17px; }
.modal-actions { margin-top: 20px; display: flex; gap: 10px; justify-content: flex-end; }

/* ---------------- 管理 ---------------- */
.pending-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #eef2f8;
  padding: 12px 2px;
  flex-wrap: wrap;
  gap: 8px;
}

.pending-row:last-child { border-bottom: none; }
.pending-info { font-size: 13px; line-height: 1.8; }
.pending-info b { color: var(--ink); }
.pending-actions { display: flex; gap: 8px; }

.status-chip {
  display: inline-block;
  border-radius: 20px;
  padding: 3px 11px;
  font-size: 12px;
  font-weight: 500;
}

.status-chip.active { background: var(--ok-soft); color: var(--ok); }
.status-chip.pending { background: var(--warn-soft); color: var(--warn); }
.status-chip.disabled, .status-chip.rejected { background: var(--danger-soft); color: var(--danger); }

.upload-form input[type=file] { padding: 7px; }

.ref-modes {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 8px;
}

.ref-modes label {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.6;
  cursor: pointer;
}

.ref-modes input[type=checkbox], .ref-modes input[type=radio] {
  width: auto;
  margin-top: 3px;
  flex-shrink: 0;
}

.ref-modes .ref-none { color: var(--danger); font-weight: 600; }

/* 参考文件列表（每个文件单独选参照方式 + 主模板参照） */
.ref-list { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.ref-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 10px 12px;
  border: 1px solid #dfe7f3;
  border-radius: 10px;
  background: #f8fbff;
  font-size: 13px;
}
.ref-row .ref-name { font-weight: 600; color: var(--ink-1); max-width: 100%; }
.ref-modes-inline { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ref-modes-inline label { display: flex; align-items: center; gap: 5px; cursor: pointer; color: var(--ink-2); }
.ref-modes-inline input[type=checkbox] { width: auto; margin: 0; }
.ref-modes-inline .ref-none { color: var(--danger); font-weight: 600; }
.ref-main { display: flex; align-items: center; gap: 5px; cursor: pointer; color: #4f46e5; font-weight: 600; }
.ref-main input[type=radio] { width: auto; margin: 0; }
.ref-row-main { border-color: #c7d2fe; background: #f3f6ff; box-shadow: 0 0 0 2px rgba(79,70,229,.08); }

/* 上传向导：步骤条 + 方式选择卡片 */
.card-head-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.card-head-line h3 { margin: 0; }
.steps-bar { display: flex; align-items: center; gap: 10px; margin: 14px 0 18px; }
.step-node { display: flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; background: #eef1f6; color: var(--muted); font-size: 13px; font-weight: 600; }
.step-node .step-num { width: 22px; height: 22px; border-radius: 50%; background: #cbd5e1; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }
.step-node.active { background: #eaf2ff; color: var(--primary); border: 1px solid #c7d2fe; }
.step-node.active .step-num { background: var(--primary); }
.step-node.done { background: var(--ok-soft); color: var(--ok); }
.step-node.done .step-num { background: var(--ok); }
.step-line { flex: 1; height: 2px; background: linear-gradient(90deg, #c7d2fe, #e2e8f0); border-radius: 2px; min-width: 24px; }
.step-title { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink-1); margin-bottom: 6px; font-size: 14px; }
.step-tag { display: inline-block; padding: 2px 9px; border-radius: 6px; background: linear-gradient(135deg, #2563eb, #4f46e5); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .5px; }
.mode-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.mode-card { display: flex; flex-direction: column; gap: 4px; padding: 16px 16px 14px; border: 2px solid #e2e8f0; border-radius: 14px; background: #fff; cursor: pointer; transition: all .18s ease; position: relative; }
.mode-card:hover { border-color: #c7d2fe; box-shadow: 0 4px 14px rgba(37,99,235,.08); }
.mode-card.active { border-color: var(--primary); background: linear-gradient(180deg, #f4f8ff, #eef4ff); box-shadow: 0 4px 16px rgba(37,99,235,.12); }
.mode-card.active::after { content: "✓"; position: absolute; top: 10px; right: 12px; width: 20px; height: 20px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.mode-card input { display: none; }
.mode-card .mode-ico { font-size: 26px; }
.mode-card .mode-title { font-weight: 700; color: var(--ink-1); font-size: 14px; }
.mode-card .mode-desc { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* AI 分析问题折叠框 */
.ai-sec-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ai-sec-chips span { background: #fff; border: 1px solid #c7d2fe; color: #4f46e5; border-radius: 999px; padding: 3px 11px; font-size: 12.5px; }
.ai-issue-box { margin-top: 8px; border: 1px solid #f3dcae; background: var(--warn-soft); border-radius: 10px; padding: 8px 12px; }
.ai-issue-box summary { cursor: pointer; font-weight: 600; color: var(--warn); font-size: 13px; user-select: none; }
.ai-issue-box ul { margin: 8px 0 2px 18px; padding: 0; font-size: 13px; color: var(--ink-2); line-height: 1.7; }
.ai-issue-box li { margin-bottom: 6px; }
.ai-issue-sug { color: var(--primary); font-size: 12px; }

@media (max-width: 720px) {
  .mode-cards { grid-template-columns: 1fr; }
  .step-label { display: none; }
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 960px) {
  .sidebar { width: 66px; }
  .brand { justify-content: center; padding: 18px 0; }
  .brand-icon { width: 40px; height: 40px; }
  .brand-name, .brand-sub, .nav-btn .nav-text, .sidebar-footer .user-name, .sidebar-footer .user-role { display: none; }
  .sidebar nav { padding: 10px 8px; }
  .nav-btn { justify-content: center; padding: 12px 0; }
  .nav-btn .nav-ico { font-size: 19px; }
  .sidebar-footer { padding: 12px 8px; }
  .logout-btn { font-size: 16px; padding: 8px 0; }
  main { margin-left: 66px; padding: 20px 16px 50px; }
  .form-grid, .settings-grid { grid-template-columns: 1fr; }
}
