/* 有错查一查 — 清新卡片化主题（移动优先） */
:root {
  --bg: #f4f7fb;
  --bg-grad: linear-gradient(180deg, #f6f9fd 0%, #eef3fa 100%);
  --card: #ffffff;
  --border: #ecf0f5;
  --border-strong: #e2e8f0;
  --text: #1f2937;
  --muted: #7a8699;
  --primary: #3b6ff0;
  --primary-dark: #2f5cd8;
  --primary-soft: #eef3ff;
  --high: #e5484d;
  --med: #d98a1f;
  --low: #28a05c;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(23,43,99,.04), 0 10px 30px rgba(23,43,99,.07);
  --shadow-hover: 0 2px 4px rgba(23,43,99,.05), 0 16px 40px rgba(23,43,99,.11);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { max-width: 100%; overflow-x: hidden; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text); font-size: 15px; line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 14px; }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--bg-grad); }
.login-card { background: var(--card); border-radius: 20px; box-shadow: var(--shadow); padding: 40px 34px; width: 100%; max-width: 400px; border: 1px solid var(--border); }
.login-card h1 { font-size: 24px; margin-bottom: 4px; letter-spacing: .5px; }
.login-card h1::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), #36b3e8); margin-right: 10px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.login-card input { width: 100%; padding: 11px 14px; border: 1px solid var(--border-strong); border-radius: 10px; margin-bottom: 14px; transition: border-color .15s; }
.login-card input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.login-cap { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.login-cap img { width: 128px; height: 44px; border-radius: 8px; border: 1px solid var(--border-strong); background: #eef2f8; }
.login-cap input { flex: 1; height: 46px; font-size: 17px; letter-spacing: 3px; text-align: center; text-transform: uppercase; margin-bottom: 0; }
.login-cap .btn { height: 44px; white-space: nowrap; }

/* ---------- 按钮 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 18px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--card); color: var(--text); font-size: 14px; transition: all .16s ease; }
.btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.btn-primary { background: linear-gradient(135deg, var(--primary), #4f7bff); border-color: transparent; color: #fff; box-shadow: 0 4px 14px rgba(66,96,240,.28); }
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-dark), var(--primary)); color: #fff; box-shadow: 0 6px 18px rgba(66,96,240,.34); }
.btn-danger { color: var(--high); border-color: #f3c4c4; }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- 顶栏 ---------- */
header { background: rgba(255,255,255,.82); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.header-in { max-width: 1120px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.logo { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 9px; letter-spacing: .3px; }
.logo .dot { width: 14px; height: 14px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), #36b3e8); display: inline-block; box-shadow: 0 2px 8px rgba(66,96,240,.4); }
nav { display: flex; gap: 3px; flex-wrap: wrap; flex: 1; }
nav a { padding: 7px 14px; border-radius: 10px; color: var(--muted); font-size: 14px; transition: all .15s; }
nav a:hover { background: var(--primary-soft); color: var(--primary); }
nav a.active { background: linear-gradient(135deg, var(--primary), #4f7bff); color: #fff; box-shadow: 0 3px 10px rgba(66,96,240,.24); }
.user-box { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.user-box .role-tag { background: var(--primary-soft); color: var(--primary); padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.ava { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--primary-soft); object-fit: cover; }
.ava-lg { width: 84px; height: 84px; border-radius: 50%; border: 3px solid var(--primary-soft); object-fit: cover; }
.prof-ava-row { display: flex; align-items: center; gap: 18px; margin-bottom: 12px; }
.mlabel { font-size: 12px; color: var(--muted); margin-top: 8px; }
.mval { font-size: 15px; font-weight: 600; }

/* ---------- 主区 ---------- */
main { max-width: 1120px; margin: 0 auto; padding: 24px 20px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; margin-bottom: 20px; transition: transform .18s ease, box-shadow .18s ease; }
.card:hover { box-shadow: var(--shadow-hover); }
.card h2 { font-size: 17px; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.card h2::before { content: ""; width: 4px; height: 18px; border-radius: 3px; background: linear-gradient(180deg, var(--primary), #36b3e8); display: inline-block; }
.card h3 { font-size: 14px; margin: 14px 0 8px; }
.muted { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; min-width: 180px; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 10px 13px; border: 1px solid var(--border-strong); border-radius: 10px; background: #fff; transition: border-color .15s, box-shadow .15s;
}
.ai-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; cursor: pointer; }
.ai-toggle input { accent-color: var(--primary); width: 16px; height: 16px; }
input[type=text]:focus, input[type=password]:focus, input[type=number]:focus, select:focus, textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
textarea { resize: vertical; min-height: 320px; line-height: 1.85; }
label.f { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; font-weight: 500; }

/* 工作台：编辑列收窄居中，不满屏 */
#view-work .card .row, #doc-title, #doc-text, #view-work label.f { max-width: 780px; margin-left: auto; margin-right: auto; }
#view-work .card .row { justify-content: flex-start; }
#doc-text { display: block; border-radius: 12px; box-shadow: inset 0 1px 2px rgba(23,43,99,.04); }

/* ---------- 表格 ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl th { color: var(--muted); font-weight: 600; font-size: 13px; background: #fafbfd; }
.tbl tr:hover td { background: #fafbff; }
.tbl td.wrap { white-space: normal; min-width: 200px; }

/* ---------- 徽章 ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; }
.badge-high { background: #f7d0d0; color: #8f0f0f; }
.badge-medium { background: #fbe9a8; color: #a16207; }
.badge-low { background: #dbeafe; color: #1d4ed8; }
.badge-gray { background: #f1f5f9; color: var(--muted); }
.badge-blue { background: var(--primary-soft); color: var(--primary); }

/* ---------- 工作台最近稿件 ---------- */
#doc-list { display: block; }
.doc-row { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 9px; background: #fff; transition: all .15s; }
.doc-row:hover { border-color: var(--primary-soft); box-shadow: var(--shadow-sm); }
.doc-row .idx { flex: 0 0 24px; width: 24px; height: 24px; line-height: 24px; text-align: center; font-size: 12px; font-weight: 600; color: var(--primary); background: #eef3ff; border-radius: 50%; }
.doc-row .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.doc-row .meta { margin-left: auto; display: flex; align-items: center; gap: 10px; white-space: nowrap; flex-shrink: 0; }
.doc-row .meta .muted { text-align: right; font-size: 12px; min-width: 108px; }
.pill { padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.pill-blue { background: var(--primary-soft); color: var(--primary); }
.pill-gray { background: #eef2f7; color: var(--muted); }
.pill-ok { background: #dcfce7; color: #16a34a; }
.pill-low { background: #dbeafe; color: #1d4ed8; }
.btn-tag { border: 1px solid var(--border-strong); background: #fff; color: var(--primary); padding: 4px 14px; border-radius: 20px; font-size: 12px; font-weight: 600; cursor: pointer; transition: all .15s; }
.btn-tag:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.doc-more { text-align: center; padding: 6px 0; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2 { margin: 0; flex: 1; }

/* ---------- 双栏对照 ---------- */
.result-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.stats-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 5px 12px; border-radius: 20px; font-size: 13px; background: #f1f5f9; }
.chip.h { color: var(--high); } .chip.m { color: var(--med); } .chip.l { color: var(--low); }
.panes { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pane { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.pane-h { padding: 13px 18px; border-bottom: 1px solid var(--border); font-size: 14px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; background: #fafbff; }
.pane-b { padding: 18px; overflow-y: auto; max-height: 66vh; font-size: 15px; line-height: 1.95; white-space: pre-wrap; word-break: break-word; }
mark { border-radius: 3px; padding: 0 1px; cursor: pointer; }
mark.high { background: #fecaca; border-bottom: 2px solid var(--high); }
mark.medium { background: #fde68a; border-bottom: 2px solid var(--med); }
mark.low { background: #bbf7d0; border-bottom: 2px solid var(--low); }
mark.flash { outline: 3px solid var(--primary); }
.finding { border: 1px solid var(--border); border-left-width: 4px; border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; background: #fff; box-shadow: 0 1px 2px rgba(23,43,99,.03); }
.finding.high { border-left-color: var(--high); }
.finding.medium { border-left-color: var(--med); }
.finding.low { border-left-color: var(--low); }
.finding .msg { font-size: 14px; }
.finding .sug { margin-top: 5px; font-size: 13px; color: var(--primary); }
.finding .meta { margin-top: 7px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.finding .meta .op { margin-left: auto; display: flex; gap: 6px; }
.finding.done { opacity: .55; }
.empty { text-align: center; color: var(--muted); padding: 44px 12px; }
table.tbl tr.sev-high, table.tbl tr.sev-high td { color: var(--high); font-weight: 700; }
table.tbl tr.sev-med td { color: var(--med); }
table.tbl td.idx { color: var(--muted); font-weight: 400; }

/* ---------- 修订稿（前后文比对） ---------- */
.rb-text { padding: 20px; font-size: 15px; line-height: 2.05; white-space: pre-wrap; word-break: break-word; background: #fff; border-radius: 12px; border: 1px solid var(--border); }
.rb-del { text-decoration: line-through; text-decoration-color: #0f172a; text-decoration-thickness: 2px; color: #111827; background: #eef1f5; border-radius: 3px; padding: 0 2px; }
.rb-add { color: var(--high); font-weight: 700; background: #fef2f2; border-radius: 3px; padding: 0 2px; }
.rb-note { background: #fef3c7; border-bottom: 1.5px dashed var(--med); border-radius: 3px; padding: 0 2px; cursor: pointer; }
.rb-note:hover { outline: 2px solid var(--med); }
.rb-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.rb-legend .k-del { color: #111827; text-decoration: line-through; text-decoration-thickness: 2px; }
.rb-legend .k-add { color: var(--high); font-weight: 700; }
.rb-legend .k-note { color: var(--med); }
.mode-tabs { display: flex; gap: 6px; background: #f1f5f9; padding: 4px; border-radius: 12px; }
.mode-tabs button { border: none; border-radius: 9px; background: transparent; padding: 8px 18px; font-size: 14px; color: var(--muted); transition: all .15s; }
.mode-tabs button.active { background: #fff; color: var(--primary); font-weight: 600; box-shadow: var(--shadow); }
.zoom-val { display: inline-block; min-width: 42px; text-align: center; font-size: 12px; color: var(--muted); font-weight: 600; }
/* ---------- 悬停弹出校对建议（批注） ---------- */
.rb-del, .rb-add, .rb-note { position: relative; }
.rb-del[data-tip]:hover::after, .rb-add[data-tip]:hover::after, .rb-note[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute; bottom: 100%; left: 0; margin-bottom: 6px; z-index: 60;
  background: #1f2937; color: #fff; padding: 8px 11px; border-radius: 8px;
  font-size: var(--tip-font, 12px); line-height: 1.55; white-space: pre-line;
  max-width: 340px; width: max-content; box-shadow: 0 6px 18px rgba(0,0,0,.25);
  font-weight: 400; pointer-events: none;
}
.rb-del[data-tip]:hover, .rb-add[data-tip]:hover, .rb-note[data-tip]:hover { z-index: 40; }
/* ---------- 修订依据列表（div 渲染） ---------- */
.rev-list { display: block; }
.rev-row { border: 1px solid var(--border); border-radius: 12px; padding: 11px 14px; margin-bottom: 9px; background: #fff; }
.rev-row.sev-high { border-color: #fecaca; background: #fff7f7; }
.rev-row.sev-high .rv-head, .rev-row.sev-high .rv-body { color: var(--high); font-weight: 600; }
.rev-row.sev-high .rv-reason { color: #b91c1c; }
.rev-row .rv-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.rev-row .rv-head .sp { flex: 1; }
.rev-row .idx { flex: 0 0 24px; width: 24px; height: 24px; line-height: 24px; text-align: center; font-size: 12px; font-weight: 600; color: var(--primary); background: #eef3ff; border-radius: 50%; }
.rev-row .rv-body { font-size: 14.5px; line-height: 1.6; }
.rev-row .rv-old { color: #b91c1c; text-decoration: line-through; }
.rev-row .rv-arrow { margin: 0 8px; color: var(--muted); }
.rev-row .rv-raw { color: var(--primary); font-weight: 600; }
.rev-row .rv-reason { margin-top: 5px; font-size: 13px; color: var(--muted); background: #f8fafc; border-radius: 8px; padding: 6px 9px; white-space: pre-line; }
.pill-high { background: #f7d0d0; color: #8f0f0f; }
.pill-med { background: #fbe9a8; color: #a16207; }
/* 结果页统计 chip */
.chip { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 13px; font-weight: 600; }
.chip.h { background: #f7d0d0; color: #8f0f0f; }
.chip.m { background: #fbe9a8; color: #a16207; }
.chip.l { background: #dbeafe; color: #1d4ed8; }

/* ---------- 批量任务 ---------- */
.progress { height: 8px; background: #eef2f7; border-radius: 20px; overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), #36b3e8); border-radius: 20px; transition: width .4s; }

/* ---------- 页脚（收紧、通透） ---------- */
footer { max-width: 1120px; margin: 0 auto; padding: 10px 20px 34px; color: var(--muted); font-size: 12px; }
footer .f-main { text-align: center; }
footer .f-by { text-align: center; margin-top: 6px; letter-spacing: .3px; opacity: .85; }

/* ---------- 提示 ---------- */
.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); background: #111827; color: #fff; padding: 11px 20px; border-radius: 12px; font-size: 14px; z-index: 200; box-shadow: 0 8px 20px rgba(0,0,0,.22); max-width: 90vw; }
.toast.ok { background: #065f46; } .toast.err { background: #991b1b; }

/* ---------- 抽屉表单 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; backdrop-filter: blur(3px); }
.modal { background: var(--card); border-radius: 18px; padding: 26px; width: 100%; max-width: 540px; max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow-hover); }
.modal h3 { margin-bottom: 12px; }
.modal .btns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; background: #d1d5db; border-radius: 24px; transition: .2s; }
.switch i:before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + i { background: var(--primary); }
.switch input:checked + i:before { transform: translateX(20px); }

.hidden { display: none !important; }

/* ---------- 移动端适配 ---------- */
@media (max-width: 860px) {
  .panes { grid-template-columns: 1fr; }
  .pane-b { max-height: none; padding: 14px; }
  .mobile-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
  .mobile-tabs button { flex: 1; }
  .finding .meta .op { margin-left: 0; }
}
@media (max-width: 720px) {
  .header-in { gap: 8px; padding: 8px 12px; }
  .logo { font-size: 16px; }
  /* 菜单独占一行、横向可滑动，避免竖屏挤成一团 */
  nav { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; flex-basis: 100%; order: 3; }
  nav::-webkit-scrollbar { display: none; }
  nav a { flex-shrink: 0; white-space: nowrap; padding: 7px 11px; font-size: 13px; }
  .user-box { font-size: 12px; gap: 6px; margin-left: auto; }
  main { padding: 14px 12px; }
  .card { padding: 18px; }
  footer { padding: 8px 12px 28px; }
}
@media (max-width: 640px) {
  .row .grow { min-width: 100%; }
  .doc-list li { flex-wrap: wrap; }
  .doc-list li .muted { display: none; }
  .doc-row { flex-wrap: wrap; gap: 8px 12px; padding: 11px 12px; align-items: center; }
  .doc-row .idx { flex: 0 0 22px; height: 22px; line-height: 22px; }
  .doc-row .t { flex: 1 1 auto; min-width: 0; }
  .doc-row .meta { width: 100%; margin-left: 0; justify-content: flex-start; gap: 8px 12px; white-space: normal; flex-wrap: wrap; }
  .doc-row .meta .muted { min-width: 0; text-align: left; }
  .result-head .btn { padding: 6px 12px; }
  input[type=text], select { font-size: 16px; }
}
.desktop-only { }
@media (max-width: 860px) { .desktop-only { display: none !important; } }
