/* 报告人 —— 设计基线 */
:root {
  --brand: #1f6feb;
  --brand-dark: #1447b8;
  --brand-soft: #e8f1ff;
  --ink: #14181f;
  --ink-2: #4a5260;
  --ink-3: #8a919e;
  --line: #e7eaf0;
  --bg: #f3f5f9;
  --card: #ffffff;
  --ok: #1f9c3f;
  --warn: #c47a00;
  --danger: #e54545;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 8px 24px -12px rgba(16, 24, 40, .12);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
h1, h2, h3, h4 { letter-spacing: -.2px; }
h1 { font-size: 22px; font-weight: 650; margin: 0 0 6px; }
h2 { font-size: 16px; font-weight: 650; margin: 0 0 4px; }
h3 { font-size: 14.5px; font-weight: 650; margin: 0 0 4px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 60px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.topbar-inner {
  width: 100%;
  max-width: 1220px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { text-decoration: none; }

/* 报告人 标识：图形来自 logo.png（蓝色圆角方 + 白色报告页 + 人物剪影 +
   琥珀折角，四角为透明），容器只负责尺寸。
   母版是 brand/logo.svg，改图用 brand/render.py 重新导出位图，
   不要给容器上 CSS 渐变 —— 圆外是透明的，渐变会从四角透出来。 */
.brand-mark {
  display: block;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}

.brand-mark img,
.brand-mark svg {
  width: 100%;
  height: 100%;
  display: block;
}

.brand-mark.lg { width: 46px; height: 46px; margin: 0 auto 14px; }

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 15.5px; font-weight: 680; }
.brand-text em { font-size: 11.5px; color: var(--ink-3); font-style: normal; }

.topnav { display: flex; gap: 4px; flex-shrink: 0; position: relative; z-index: 20; }

.topnav a {
  padding: 7px 14px;
  border-radius: 9px;
  color: var(--ink-2);
  font-size: 13.5px;
  transition: background .15s, color .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  cursor: pointer;
  /* 不设 position/z-index：实测在本站点布局里反而会让链接脱离命中测试栈，
     导致真实点击落到父容器上（getBoundingClientRect 与实际命中区域不一致）。 */
}

.topnav a:hover { background: #f2f4f8; text-decoration: none; }
.topnav a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }

/* 未登录时导航仍然可点（点击会引导到登录页），只是弱化外观。
   不用 visibility:hidden —— 那会让元素「看着在、点不到」。 */
.topnav.is-guest a { color: var(--ink-3); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.account-hint { font-size: 12.5px; color: var(--ink-3); }

.account { display: flex; align-items: center; gap: 9px; }

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 650;
  flex-shrink: 0;
}

.account-name { font-size: 13px; color: var(--ink-2); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 主体 ---------- */
.view {
  flex: 1;
  width: 100%;
  max-width: 1220px;
  margin: 0 auto;
  padding: 26px 24px 56px;
}

.narrow { max-width: 880px; margin: 0 auto; }

.footer {
  border-top: 1px solid var(--line);
  background: var(--card);
  padding: 16px 24px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-3);
}

.dot { display: inline-block; margin: 0 6px; color: #d3d8e2; }
.footer .dot { margin: 0 8px; }

/* ---------- 控件 ---------- */
.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 18px;
  cursor: pointer;
  font-weight: 550;
  font-size: 13.5px;
  transition: background .15s, border-color .15s, transform .05s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn:active { transform: translateY(1px); }
.btn:disabled { cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-primary:disabled { background: #b9cdf2; }
.btn-ghost { background: var(--card); border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { border-color: #cfd6e2; background: #fafbfd; }
.btn-danger { background: #fff2f2; color: var(--danger); border-color: #ffdcdc; }
.btn-danger:hover { background: #ffe9e9; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-lg { padding: 11px 24px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-code { flex-shrink: 0; min-width: 112px; }
.btn-ghost.danger { color: var(--danger); border-color: #ffdcdc; }

.link-btn {
  border: 0;
  background: none;
  color: var(--brand);
  cursor: pointer;
  font-size: 12.5px;
  padding: 2px 4px;
  border-radius: 5px;
}
.link-btn:hover { background: var(--brand-soft); }
.link-btn.danger { color: var(--danger); }
.link-btn.danger:hover { background: #fff1f1; }

.grow { flex: 1; }

.input, select.input, textarea.input {
  width: 100%;
  border: 1px solid var(--line);
  background: #fafbfd;
  border-radius: 10px;
  padding: 10px 13px;
  outline: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
  font-size: 13.5px;
}

.input:focus {
  border-color: #9dc0f5;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(31, 111, 235, .1);
}

.input::placeholder { color: #b3b9c4; }
select.input { cursor: pointer; appearance: none; background-image: linear-gradient(45deg, transparent 50%, #9aa2b1 50%), linear-gradient(135deg, #9aa2b1 50%, transparent 50%); background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.input-title { font-size: 15px; font-weight: 550; }

.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }

/* 多行文本：整段照搬进报告的内容，需要能看清全文，所以跨满整行 */
.input.textarea {
  resize: vertical;
  min-height: 96px;
  line-height: 1.65;
  padding: 10px 13px;
  font-family: inherit;
}
.field-wide { grid-column: 1 / -1; }

/* 字数统计贴在标签右侧，接近上限时变橙提醒 */
.field-count {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.field-count.near { color: var(--warn); }

/* 模板参照卡：附件槽之后，告诉用户该传什么、去哪儿拿空模板。
   一个槽位一份模板，所以是一组卡片（.tpl-list）；单份时也走同一套样式。 */
.tpl-list { display: flex; flex-direction: column; }
.tpl-card {
  margin-top: 14px;
  background: #f7f9fc;
  border: 1px dashed #ccd7e6;
  border-radius: 12px;
  padding: 14px 16px;
}
.tpl-head { display: flex; align-items: center; gap: 11px; }
.tpl-badge {
  flex-shrink: 0;
  padding: 3px 7px;
  border-radius: 5px;
  background: #1d7a46;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
}
.tpl-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tpl-titles strong { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.tpl-sub { font-size: 12px; color: var(--ink-3); line-height: 1.45; }
.tpl-dl { flex-shrink: 0; text-decoration: none; }

.tpl-sheets { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.tpl-sheet {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12.5px;
  line-height: 1.5;
  padding: 6px 9px;
  background: #fff;
  border: 1px solid #e3eaf3;
  border-radius: 7px;
}
.tpl-sheet-no {
  flex-shrink: 0;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 10.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
  transform: translateY(1px);
}
.tpl-sheet-name { flex-shrink: 0; font-weight: 600; color: var(--ink-2); }
.tpl-sheet-note { color: var(--ink-3); min-width: 0; }
.tpl-note { margin: 10px 0 0; font-size: 12px; color: var(--ink-3); line-height: 1.55; }

/* 列名对照：模板的每一列用 chip 摆出来，用户不必先下载就知道要准备哪些数据 */
.tpl-cols { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.tpl-col {
  padding: 3px 8px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #e3eaf3;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--ink-2);
  white-space: nowrap;
}

@media (max-width: 680px) {
  .tpl-head { flex-wrap: wrap; }
  .tpl-dl { width: 100%; margin-top: 4px; }
  .tpl-sheet { flex-wrap: wrap; }
  .tpl-sheet-note { flex-basis: 100%; padding-left: 25px; }
  .tpl-col { white-space: normal; }
}

/* 草稿恢复提示条：工程概况、填入内容可能有上千字，被登录跳转打断后回来先告诉用户
   "内容还在"，否则用户会以为自己白写了，重新敲一遍。 */
.draft-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  margin-bottom: 18px;
  background: #fff8ec;
  border: 1px solid #f3e0bf;
  border-radius: 10px;
  font-size: 12.5px;
  color: #8a6320;
  line-height: 1.5;
}
.draft-bar-text { flex: 1; min-width: 0; }
.draft-bar .link-btn { flex-shrink: 0; color: var(--brand); }
/* .link-btn 默认 hover 是浅蓝，落在琥珀色条上会脏，这里换成同色系深一点 */
.draft-bar .link-btn:hover { background: #f7e9d0; }

.field-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 550;
  color: var(--ink-2);
  margin-bottom: 7px;
}

.req { color: var(--danger); font-weight: 600; }
.opt { color: var(--ink-3); font-size: 11.5px; font-weight: 400; }

.field-hint { font-size: 12px; color: var(--ink-3); margin: 6px 0 0; line-height: 1.5; }
.field-hint.accent { color: var(--brand); background: var(--brand-soft); padding: 5px 9px; border-radius: 7px; display: inline-block; }
.field-error { font-size: 12px; color: var(--danger); margin: 6px 0 0; }

.field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 18px; }

/* ---------- 面板 ---------- */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}

.panel + .panel, .report-view .panel { margin-top: 16px; }

.panel-head { margin-bottom: 16px; }
.panel-head.row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.panel-sub { font-size: 12.5px; color: var(--ink-3); margin: 0; }

.sec-title { font-size: 13.5px; font-weight: 650; color: var(--ink-2); margin: 0 0 14px; }

.page-head { margin-bottom: 20px; }
.page-head h1 { margin-top: 8px; }
.page-sub { color: var(--ink-3); font-size: 13.5px; margin: 0; }

.back { font-size: 12.5px; color: var(--ink-3); display: inline-block; margin-bottom: 4px; }
.back:hover { color: var(--brand); text-decoration: none; }

/* ---------- 首页 ---------- */
.home { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 18px; align-items: start; }

/* 游客说明条：横跨两列，出现在两栏上方，不打断左右布局 */
.guest-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  margin-bottom: 16px;
  background: var(--brand-soft);
  border: 1px solid #d3e2fb;
  border-radius: 12px;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.5;
}
/* 表单页里它插在 form-card 内部，贴顶不留外边距，改成内边距分隔 */
.form-card > .guest-bar { margin-bottom: 18px; }
.guest-bar strong { color: var(--brand); font-weight: 600; }
.guest-bar-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  font-style: italic;
  display: grid;
  place-items: center;
  font-family: Georgia, serif;
}
.guest-bar > span:nth-child(2) { flex: 1; min-width: 0; }

@media (max-width: 680px) {
  .guest-bar { flex-wrap: wrap; }
  .guest-bar > span:nth-child(2) { flex-basis: 100%; order: 3; }
}

.cat-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }

.cat-card {
  display: flex;
  gap: 13px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfe;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background .15s;
  text-align: left;
  width: 100%;
  align-items: flex-start;
  position: relative;
}

.cat-card:hover {
  border-color: #bcd2f2;
  background: #fff;
  box-shadow: 0 2px 12px -4px rgba(31, 111, 235, .2);
}

.cat-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.cat-body { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.cat-body strong { font-weight: 620; font-size: 14px; line-height: 1.35; }
.cat-body em { font-size: 11.5px; color: var(--brand); font-style: normal; margin-top: 1px; }

.cat-desc { font-size: 12px; color: var(--ink-3); margin-top: 4px; line-height: 1.45; }

.cat-badge {
  font-size: 10.5px;
  font-weight: 500;
  padding: 1px 7px;
  border-radius: 5px;
  background: #fff6e6;
  color: var(--warn);
  white-space: nowrap;
  position: absolute;
  top: 10px;
  right: 10px;
}

.cat-card.cat-soon { opacity: .9; }

/* ---------- 分类筛选 ---------- */
.chips { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 14px; }

.chip {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 20px;
  padding: 4px 12px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.chip:hover { border-color: #cfd6e2; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip-n { font-style: normal; font-size: 11px; opacity: .75; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }

.table th {
  text-align: left;
  font-weight: 550;
  color: var(--ink-3);
  font-size: 12px;
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.table td { padding: 12px; border-bottom: 1px solid #f2f4f8; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.row-click { cursor: pointer; }
.row-click:hover { background: #fafbfd; }
.table .col-act { width: 1%; text-align: right; white-space: nowrap; }

.cell-title { font-weight: 550; color: var(--ink); }
.cell-sub { font-size: 11.5px; color: var(--danger); margin-top: 2px; }
.cell-time { color: var(--ink-3); font-size: 12px; white-space: nowrap; }

.cat-tag {
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 6px;
  background: #f2f4f8;
  color: var(--ink-2);
  white-space: nowrap;
}

.mini-bar { height: 3px; background: #eceff4; border-radius: 2px; margin-top: 5px; overflow: hidden; width: 76px; }
.mini-bar i { display: block; height: 100%; background: var(--brand); border-radius: 2px; transition: width .4s; }

/* ---------- 状态标签 ---------- */
.tag { display: inline-block; padding: 2px 9px; border-radius: 6px; font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.tag.lg { font-size: 12.5px; padding: 3px 11px; }
.tag-pending { background: #f0f2f7; color: var(--ink-2); }
.tag-queued { background: #fff6e6; color: var(--warn); }
.tag-running { background: var(--brand-soft); color: var(--brand); }
.tag-done { background: #e9f7ec; color: var(--ok); }
.tag-failed { background: #fff1f1; color: var(--danger); }

/* ---------- 空态 / 加载 ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--ink-3); font-size: 13.5px; }
.empty.sm { padding: 32px 16px; }
.empty-icon { font-size: 34px; opacity: .3; margin-bottom: 10px; }
.empty p { margin: 0 0 14px; }

.boot { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 20px; gap: 14px; color: var(--ink-3); font-size: 13px; }
.boot p { margin: 0; }

.boot-spinner, .spinner {
  border: 2.5px solid #e3e8f0;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.boot-spinner { width: 26px; height: 26px; }
.spinner.sm { width: 14px; height: 14px; border-width: 2px; display: inline-block; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 登录 ---------- */
.login-wrap { max-width: 400px; margin: 7vh auto 0; padding: 0 4px; }

.login-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 34px 30px 28px;
  box-shadow: 0 20px 50px -24px rgba(16, 24, 40, .25);
}

.login-head { text-align: center; margin-bottom: 24px; }
.login-head h1 { font-size: 19px; margin: 0 0 6px; }
.login-head p { font-size: 12.5px; color: var(--ink-3); margin: 0; }

.login-form .field { margin-bottom: 16px; }
.login-hint { font-size: 11.5px; color: var(--ink-3); text-align: center; margin: 14px 0 0; line-height: 1.5; }

/* 未登录就点了「新建」时的说明条：避免看起来像点了没反应 */
.login-notice {
  display: flex; flex-direction: column; gap: 2px;
  margin: 14px 0 0; padding: 10px 12px;
  background: var(--brand-soft); border-radius: 10px;
  font-size: 12.5px; line-height: 1.55; text-align: left;
}
.login-notice strong { font-weight: 600; color: var(--brand); }
.login-notice span { color: var(--ink-2); }

.code-row { display: flex; gap: 9px; }
.code-row .input { flex: 1; min-width: 0; }

/* ---------- 选类型 ---------- */
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }

.pick-card {
  display: flex;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--card);
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, box-shadow .15s, transform .1s;
  align-items: flex-start;
  position: relative;
  box-shadow: var(--shadow);
}

.pick-card:hover { border-color: #bcd2f2; box-shadow: 0 6px 20px -8px rgba(31, 111, 235, .3); transform: translateY(-1px); }

.pick-body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.pick-body strong { font-size: 14.5px; font-weight: 640; }
.pick-meta { font-size: 11.5px; color: var(--ink-3); font-family: var(--mono); margin-top: 2px; }
.pick-go { font-size: 12px; color: var(--brand); font-weight: 550; white-space: nowrap; align-self: center; }

/* ---------- 填表 ---------- */
.form-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 28px 22px;
  box-shadow: var(--shadow);
}

.form-head { display: flex; gap: 13px; align-items: flex-start; padding-bottom: 18px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.form-sec { font-size: 13px; font-weight: 650; color: var(--ink-3); text-transform: none; margin: 22px 0 14px; padding-top: 4px; }
.form-sec:first-of-type { margin-top: 0; }

.form-actions { display: flex; align-items: center; gap: 10px; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }

/* ---------- 上传槽 ---------- */
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.slot-wrap { display: flex; flex-direction: column; }
.slot-head { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); margin-bottom: 5px; }
.slot-wrap > .field-hint { margin-bottom: 8px; }
/* 一个槽里可能有多个文件（可多选的槽），纵向堆叠并留出间距 */
.slot { display: flex; flex-direction: column; gap: 8px; }
.slot-count { font-size: 11px; color: var(--ink-3); margin: 0; }

.slot-drop {
  border: 1.5px dashed #d6dce7;
  border-radius: 12px;
  padding: 22px 16px;
  background: #fbfcfe;
  transition: border-color .15s, background .15s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.slot-drop:hover, .slot.over .slot-drop { border-color: #9dc0f5; background: #f5f9ff; }
/* 已有文件之后再挂的投放区收窄一点，别把已选列表挤下去 */
.slot-drop.compact { padding: 13px 12px; border-style: dashed; }

.drop-plus { font-size: 22px; color: #b3b9c4; line-height: 1; font-weight: 300; }
.drop-main { font-size: 12.5px; color: var(--ink-2); }
.drop-sub { font-size: 11px; color: var(--ink-3); }

.slot-filled {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1.5px solid #cfe8d6;
  background: #f7fdf9;
  border-radius: 12px;
  padding: 12px 14px;
}

.file-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand);
  display: grid;
  place-items: center;
  font-size: 9.5px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: .3px;
  overflow: hidden;
}

.slot-filled .file-meta, .file-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.file-meta strong { font-size: 12.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta em { font-size: 11px; color: var(--ink-3); font-style: normal; }

/* 槽头右侧的「核对」按钮：用 flex:1 的占位把它顶到最右 */
.slot-head-sp { flex: 1; }
.slot-check { font-size: 12px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--brand); background: var(--card); cursor: pointer; }
.slot-check:hover { background: var(--brand-soft); border-color: #bcd3f7; }
.slot-check:disabled { color: var(--ink-3); cursor: default; background: #f6f7f9; }

/* 核对结果 */
.check-result { margin-top: 10px; border: 1px solid var(--line); border-radius: 11px; padding: 11px 13px; background: #fafbfd; font-size: 12.5px; }
.check-result.ok { border-color: #cfe8d6; background: #f7fdf9; }
.check-result.bad { border-color: #ffdcdc; background: #fff8f8; }
.check-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.check-head strong { font-size: 12.5px; font-weight: 600; }
.check-head em { font-size: 12px; color: var(--ink-3); font-style: normal; }
.check-counts { display: flex; gap: 8px; font-size: 11.5px; }
.check-msg { margin: 7px 0 0; color: var(--ink-2); line-height: 1.6; }
.check-issues { margin: 8px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; line-height: 1.55; }
.check-issues.muted { color: var(--ink-3); }
.lv-blocker { color: var(--danger); }
.lv-warn { color: #b7791f; }
.lv-info { color: var(--ink-3); }
.check-detail { margin-top: 9px; }
.check-detail summary { cursor: pointer; font-size: 12px; color: var(--ink-3); }
.check-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 11.5px; }
.check-table th, .check-table td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--line); }
.check-table th { color: var(--ink-3); font-weight: 500; }
.check-table td { font-variant-numeric: tabular-nums; }
.check-table tr.bad-row td { color: var(--danger); }

/* ---------- 产出提示 ---------- */
.out-note { display: flex; align-items: flex-start; gap: 10px; margin-top: 18px; padding: 12px 14px; background: #fafbfd; border: 1px solid var(--line); border-radius: 11px; }
.out-note-label { font-size: 12px; color: var(--ink-3); flex-shrink: 0; padding-top: 1px; }
.out-note-list { display: flex; gap: 7px; flex-wrap: wrap; }
.out-chip { font-size: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 7px; padding: 3px 9px; color: var(--ink-2); }

/* ---------- 通知条 ---------- */
.notice { border-radius: 12px; padding: 14px 16px; margin-top: 16px; font-size: 13px; border: 1px solid var(--line); background: #fafbfd; }
.notice strong { display: block; font-weight: 620; margin-bottom: 3px; }
.notice p { margin: 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.55; }
.notice .btn { margin-top: 10px; }
.notice.warn { background: #fffaf0; border-color: #f5e3bd; }
.notice.warn strong { color: var(--warn); }
.notice.info { background: var(--brand-soft); border-color: #c9dcfb; }
.notice.info strong { color: var(--brand-dark); }
.notice.error { background: #fff5f5; border-color: #ffd9d9; }
.notice.error strong { color: var(--danger); }

/* ---------- 报告详情 ---------- */
.report-head { margin-bottom: 18px; }
.report-title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.report-title-row h1 { margin: 0; }
.report-meta { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-3); margin-top: 6px; }

.status-panel { margin-top: 0; }
.status-line { display: flex; align-items: center; gap: 9px; font-size: 13.5px; }
.status-pct { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--brand); font-weight: 600; font-size: 13px; }

.progress { height: 8px; background: #eceff4; border-radius: 4px; overflow: hidden; margin: 12px 0 8px; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #4c8ff5); border-radius: 4px; transition: width .4s ease; }

.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1px; background: var(--line); border-radius: 11px; overflow: hidden; }
.metric { background: var(--card); padding: 16px 18px; }
.metric-label { display: block; font-size: 11.5px; color: var(--ink-3); }
.metric-value { display: block; font-size: 24px; font-weight: 650; color: var(--brand); line-height: 1.25; font-variant-numeric: tabular-nums; margin-top: 2px; }

.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 20px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed #f0f2f7; font-size: 12.5px; }
.kv-k { color: var(--ink-3); flex-shrink: 0; }
.kv-v { color: var(--ink); text-align: right; word-break: break-word; }

/* 长文本（工程概况、填入内容）：左右并排会把文字挤成一列单字，
   改成上下排、跨满整行，并保留换行。 */
.kv.wide { grid-column: 1 / -1; flex-direction: column; gap: 4px; align-items: flex-start; }
.kv.wide .kv-v { text-align: left; white-space: pre-wrap; line-height: 1.65; }

.input-list { display: flex; flex-direction: column; gap: 8px; }
.input-row { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfe; }

/* ---------- 预览 ---------- */
.preview-body {
  background: #fff;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 12px 12px;
  min-height: 300px;
  overflow: auto;
}

.sheet-tabs, .preview-body + .sheet-tabs { border-radius: 0; }

.sheet-tabs {
  display: flex;
  gap: 2px;
  padding: 10px 12px 0;
  border: 1px solid var(--line);
  border-bottom: 0;
  overflow-x: auto;
  background: #fafbfd;
  border-radius: 12px 12px 0 0;
}

.sheet-tabs:empty { display: none; }

.sub-tab {
  border: 1px solid transparent;
  border-bottom: 0;
  background: transparent;
  padding: 6px 13px;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  font-size: 12px;
  color: var(--ink-2);
  white-space: nowrap;
}

.sub-tab:hover { background: #f2f4f8; }
.sub-tab.on { background: #fff; border-color: var(--line); color: var(--brand); font-weight: 550; margin-bottom: -1px; }

.tab {
  border: 0;
  background: transparent;
  padding: 10px 16px;
  cursor: pointer;
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab:hover { color: var(--ink-2); }
.tab.on { color: var(--brand); border-bottom-color: var(--brand); }

.out-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

.sheet-html { padding: 10px; }
.sheet-html table { border-collapse: collapse; font-size: 12px; font-family: var(--mono); }
.sheet-html td, .sheet-html th {
  border: 1px solid #e2e6ee;
  padding: 4px 8px;
  white-space: nowrap;
  color: var(--ink-2);
  vertical-align: top;
}
.sheet-html th { background: #f6f8fb; font-weight: 600; position: sticky; top: 0; z-index: 1; }
.sheet-html tr:nth-child(even) td { background: #fcfdfe; }

.doc-preview { padding: 24px 28px; background: #eef0f4; min-height: 300px; }
.doc-preview .docx-wrapper { background: transparent; padding: 0; }
.doc-preview .docx-wrapper > section.docx {
  box-shadow: 0 2px 14px rgba(16, 24, 40, .12);
  margin-bottom: 20px;
  border-radius: 2px;
  background: #fff;
}

.pdf-frame { width: 100%; height: 70vh; border: 0; display: block; }

/* ---------- 弹层 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, .45);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 20px;
  animation: fade .15s ease;
}

@keyframes fade { from { opacity: 0; } }

.modal { background: var(--card); border-radius: 16px; width: 100%; max-width: 400px; padding: 24px; box-shadow: 0 24px 60px -20px rgba(16, 24, 40, .4); }
.modal-title { font-size: 16px; font-weight: 650; margin: 0 0 8px; }
.modal-text { font-size: 13.5px; color: var(--ink-2); margin: 0 0 20px; line-height: 1.6; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- Toast ---------- */
#toast-host {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: #14181f;
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, .4);
  animation: slideDown .2s ease;
  max-width: 520px;
}

.toast.error { background: #b93a3a; }
.toast.ok { background: #1f7a37; }
.toast.warn { background: #a06a00; }

@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } }

.mono { font-family: var(--mono); font-size: 12px; }

/* ---------- 响应式 ---------- */
@media (max-width: 980px) {
  .home { grid-template-columns: 1fr; }
  .cat-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}

@media (max-width: 680px) {
  .topbar { height: 54px; }
  .topbar-inner { padding: 0 14px; gap: 10px; }
  .view { padding: 18px 14px 40px; }
  .form-card { padding: 20px 16px 18px; }
  .panel { padding: 16px; }
  .brand-text em { display: none; }
  .topnav { gap: 0; }
  .topnav a { padding: 6px 10px; font-size: 13px; min-width: 48px; }
  .account-name { display: none; }
  .field-grid { grid-template-columns: 1fr; }
  .sheet-html table { font-size: 11px; }
  .doc-preview { padding: 10px; }
}
