* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.55 -apple-system, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  color: #1f2937; background: #f3f4f6; display: flex; flex-direction: column;
}
button, select, input, textarea { font: inherit; }
button {
  border: 1px solid #d1d5db; background: #fff; border-radius: 6px; padding: 5px 12px; cursor: pointer;
}
button:hover { background: #f9fafb; }
button.primary { background: #2563eb; color: #fff; border-color: #2563eb; }
button.primary:hover { background: #1d4ed8; }
.muted { color: #6b7280; }
.small { font-size: 12px; }
.hidden { display: none !important; }

header {
  display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: #1e3a8a; color: #fff;
}
header button { border-color: transparent; }
header .muted { color: #c7d2fe; }
.brand { font-weight: 600; font-size: 16px; }
.tabs { display: flex; gap: 4px; }
.tab { background: transparent; color: #c7d2fe; }
.tab:hover { background: rgba(255,255,255,.1); }
.tab.active { background: #fff; color: #1e3a8a; font-weight: 600; }
.progress { width: 160px; height: 8px; background: rgba(255,255,255,.25); border-radius: 4px; overflow: hidden; }
#progressBar { height: 100%; width: 0; background: #34d399; transition: width .3s; }
.spacer { flex: 1; }
.rater-badge { background: #fbbf24; color: #1f2937; font-weight: 600; }
.dropdown { position: relative; }
.menu {
  display: none; position: absolute; right: 0; top: 110%; background: #fff; color: #1f2937; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18); min-width: 330px; z-index: 20; overflow: hidden;
}
.menu.open { display: block; }
.menu a { display: block; padding: 10px 14px; cursor: pointer; }
.menu a:hover { background: #eff6ff; }

main { flex: 1; display: grid; grid-template-columns: 220px minmax(0, 1fr) 560px; min-height: 0; }

#sidebar { background: #fff; border-right: 1px solid #e5e7eb; display: flex; flex-direction: column; min-height: 0; }
.filters { display: flex; gap: 6px; padding: 8px; border-bottom: 1px solid #e5e7eb; }
.filters select { flex: 1; padding: 3px; }
#itemList { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
#itemList li {
  padding: 6px 10px; border-bottom: 1px solid #f3f4f6; cursor: pointer; display: flex; gap: 8px; align-items: flex-start;
}
#itemList li:hover { background: #f9fafb; }
#itemList li.active { background: #dbeafe; }
#itemList .seq { font-weight: 600; min-width: 28px; color: #374151; }
#itemList .t { font-size: 12px; color: #4b5563; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #d1d5db; flex: none; margin-top: 6px; }
.dot.draft { background: #f59e0b; }
.dot.done { background: #10b981; }

#reader { display: flex; flex-direction: column; min-height: 0; background: #fff; }
.searchbar { padding: 8px 12px; border-bottom: 1px solid #e5e7eb; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.searchbar input { width: 200px; padding: 4px 8px; border: 1px solid #d1d5db; border-radius: 6px; }
.searchbar button { padding: 3px 9px; }
#chips { display: flex; flex-wrap: wrap; gap: 4px; width: 100%; }
.chip { font-size: 12px; padding: 1px 8px; border-radius: 10px; background: #eef2ff; border: 1px solid #c7d2fe; color: #3730a3; }
.chip.on { background: #4f46e5; color: #fff; }
#fulltext { flex: 1; overflow-y: auto; padding: 16px 28px 80px; font-size: 15px; line-height: 1.8; }
#fulltext h3, #fulltext h4, #fulltext h5, #fulltext h6 { margin: 18px 0 6px; color: #111827; }
#fulltext h3 { font-size: 19px; }
#fulltext h4 { font-size: 16px; }
#fulltext h5, #fulltext h6 { font-size: 15px; }
#fulltext p { margin: 6px 0; }
#fulltext .tbl { overflow-x: auto; margin: 10px 0; }
#fulltext table { border-collapse: collapse; font-size: 13px; line-height: 1.4; }
#fulltext td, #fulltext th { border: 1px solid #d1d5db; padding: 3px 6px; }
mark { background: #fde68a; padding: 0 1px; border-radius: 2px; }
mark.cur { background: #f97316; color: #fff; }

#form { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid #e5e7eb; }
#itemHead { padding: 12px 16px; background: #fff; border-bottom: 1px solid #e5e7eb; }
#itemHead h2 { font-size: 15px; margin: 0 0 6px; line-height: 1.4; }
#itemHead .meta { display: grid; grid-template-columns: 88px 1fr; gap: 2px 8px; font-size: 13px; }
#itemHead .meta b { color: #6b7280; font-weight: 500; }
#itemHead .outcome { background: #fef3c7; padding: 0 4px; border-radius: 3px; font-weight: 600; }
.verdict { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.badge { font-size: 12px; padding: 1px 8px; border-radius: 10px; background: #e5e7eb; color: #374151; white-space: nowrap; }
.badge.Low { background: #d1fae5; color: #065f46; }
.badge.Some { background: #fef3c7; color: #92400e; }
.badge.High { background: #fee2e2; color: #991b1b; }
.badge.big { font-size: 13px; padding: 2px 10px; font-weight: 600; }

#formBody { flex: 1; overflow-y: auto; padding: 10px 14px 20px; }
.card { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; margin-bottom: 10px; }
.card > .ch { padding: 8px 12px; border-bottom: 1px solid #f3f4f6; display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.card > .ch .en { font-weight: 400; color: #6b7280; font-size: 12px; margin-left: 6px; }
.q { padding: 8px 12px; border-bottom: 1px solid #f3f4f6; }
.q:last-child { border-bottom: none; }
.q.unanswered .qt::after { content: " ·未答"; color: #ef4444; font-size: 12px; font-weight: 400; }
.qt { font-weight: 500; }
.qt .qid { display: inline-block; min-width: 28px; color: #2563eb; font-weight: 700; }
.qen { font-size: 12px; color: #6b7280; margin: 1px 0 0 28px; }
.qrule { font-size: 12px; color: #92400e; background: #fffbeb; margin: 4px 0 0 28px; padding: 2px 6px; border-radius: 4px; }
.opts { display: flex; gap: 4px; margin: 6px 0 0 28px; flex-wrap: wrap; }
.opt {
  padding: 3px 10px; border: 1px solid #d1d5db; border-radius: 6px; background: #fff; cursor: pointer; font-size: 13px;
  user-select: none;
}
.opt:hover { border-color: #2563eb; }
.opt.sel { background: #2563eb; border-color: #2563eb; color: #fff; }
.opt .k { font-weight: 700; margin-right: 3px; }
.opt .z { font-size: 11px; opacity: .8; }
.q textarea, .q input[type=text], .card textarea {
  width: calc(100% - 28px); margin: 6px 0 0 28px; border: 1px solid #d1d5db; border-radius: 6px; padding: 5px 8px;
}
.card textarea { width: calc(100% - 24px); margin: 8px 12px 10px; min-height: 60px; }
.legend { font-size: 12px; color: #4b5563; padding: 6px 12px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.legend b { color: #111827; }

.form-foot { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #fff; border-top: 1px solid #e5e7eb; }
.form-foot #missing { flex: 1; text-align: center; }

.overlay { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: flex; align-items: center; justify-content: center; z-index: 50; }
.login-card, .guide-card { background: #fff; border-radius: 12px; padding: 28px 32px; width: 460px; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.guide-card { width: 720px; max-height: 85vh; overflow-y: auto; position: relative; }
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.login-card label { display: block; margin: 18px 0 8px; font-weight: 600; }
.rater-choices { display: flex; gap: 8px; margin-bottom: 10px; }
.rater-choices button { flex: 1; padding: 10px; font-size: 15px; }
.row { display: flex; gap: 8px; }
.row input { flex: 1; padding: 6px 10px; border: 1px solid #d1d5db; border-radius: 6px; }
#raterList { margin-top: 14px; }
.close { position: absolute; right: 14px; top: 10px; border: none; font-size: 22px; background: none; }
.guide-card dt { font-weight: 600; margin-top: 10px; }
.guide-card dd { margin: 2px 0 0; color: #374151; }
.guide-card table { border-collapse: collapse; margin-top: 8px; font-size: 13px; }
.guide-card td { border: 1px solid #e5e7eb; padding: 3px 8px; }

.design-opts { padding: 8px 12px; display: grid; gap: 4px; }
.design-opts label { display: flex; gap: 8px; align-items: center; padding: 4px 8px; border-radius: 6px; cursor: pointer; }
.design-opts label:hover { background: #f3f4f6; }
.design-opts label.sel { background: #dbeafe; }
