:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --green: #16a34a;
  --green-light: #f0fdf4;
  --red: #dc2626;
  --red-light: #fef2f2;
  --amber: #d97706;
  --amber-light: #fffbeb;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 14px rgba(15, 23, 42, .06);
  --shadow-lg: 0 8px 30px rgba(15, 23, 42, .14);
}

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

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  font-size: 15px;
  line-height: 1.6;
}

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--gray-300); background: #fff; color: var(--gray-700);
  padding: 8px 16px; border-radius: 8px; font-size: 14px; font-weight: 500;
  transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--gray-400); background: var(--gray-50); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.green:hover { background: #15803d; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger:hover { background: #b91c1c; }
.btn.sm { padding: 4px 10px; font-size: 13px; border-radius: 6px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--gray-500); }
.btn.ghost:hover { background: var(--gray-100); color: var(--gray-700); }

.card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; border: 1px solid var(--gray-200);
}

/* ---- 登录页 ---- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #eff6ff 0%, #f8fafc 55%, #f0fdf4 100%);
  padding: 20px;
}
.login-card { width: 100%; max-width: 420px; text-align: center; padding: 40px 36px; }
.login-card h1 { font-size: 22px; color: var(--gray-900); margin-bottom: 6px; }
.login-card .sub { color: var(--gray-500); font-size: 14px; margin-bottom: 28px; }
.login-card .code-input {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--gray-300); border-radius: 8px;
  font-size: 16px; letter-spacing: 2px; text-align: center; text-transform: uppercase;
}
.login-card .code-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.login-card .btn { width: 100%; margin-top: 16px; padding: 12px; font-size: 15px; }

/* ---- 审阅工作区 ---- */
/* ---- 固定头部（顶栏 + 审阅进度，始终可见） ---- */
.app-header { position: sticky; top: 0; z-index: 40; background: #fff; box-shadow: 0 1px 0 var(--gray-200); }

.topbar {
  background: #fff;
  padding: 0 24px; height: 58px; display: flex; align-items: center; justify-content: space-between;
}
.topbar .brand { font-weight: 700; color: var(--gray-900); font-size: 16px; display: flex; align-items: center; gap: 8px; }
.topbar .brand .logo { width: 30px; height: 30px; border-radius: 8px; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; }
.topbar .user { display: flex; align-items: center; gap: 12px; color: var(--gray-600); font-size: 14px; }

.progress-strip {
  background: var(--gray-50); border-bottom: 1px solid var(--gray-200); padding: 10px 24px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.progress-strip .bar { flex: 1; min-width: 160px; height: 8px; background: var(--gray-200); border-radius: 99px; overflow: hidden; }
.progress-strip .bar > div { height: 100%; background: linear-gradient(90deg, var(--primary), #3b82f6); border-radius: 99px; transition: width .3s; }
.progress-strip .txt { color: var(--gray-600); font-size: 13px; white-space: nowrap; }

.workspace { display: flex; gap: 20px; padding: 20px 24px; max-width: 1280px; margin: 0 auto; align-items: flex-start; }

.sidebar {
  width: 280px; flex-shrink: 0; background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid var(--gray-200); overflow: hidden;
  position: sticky; top: 118px; max-height: calc(100vh - 140px); display: flex; flex-direction: column;
}
.sidebar .dim-name {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px 6px; font-size: 14px; color: var(--gray-700); font-weight: 700;
}
.sidebar .dim-name::before {
  content: ''; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
  background: var(--dimc, var(--gray-400));
}
.sidebar .item-link {
  display: flex; align-items: center; gap: 8px; padding: 7px 14px 7px 24px;
  font-size: 13.5px; color: var(--gray-700); border-left: 3px solid transparent; cursor: pointer;
}
.sidebar .item-link:hover { background: var(--gray-50); }
.sidebar .item-link.active { border-left-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gray-300); flex-shrink: 0; }
.dot.done { background: var(--green); }
.sidebar .scroll { overflow-y: auto; flex: 1; padding-bottom: 12px; }

.main { flex: 1; min-width: 0; }

.item-card { max-width: 860px; margin: 0 auto; }
.item-card .meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.tag {
  display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 99px;
  font-size: 13px; font-weight: 600; background: var(--gray-100); color: var(--gray-600);
}
.tag.dim { font-size: 14.5px; font-weight: 700; }
.tag.no { background: var(--gray-800); color: #fff; }
.tag.done { background: var(--green-light); color: var(--green); }

.item-content {
  font-size: 18px; font-weight: 600; color: var(--gray-900); line-height: 1.75;
  background: var(--gray-50); border-left: 4px solid var(--gray-300);
  border-radius: 10px; padding: 14px 16px;
  margin: 12px 0 2px; white-space: pre-wrap; word-break: break-word;
}

.dim-def {
  background: var(--primary-light); border: 1px solid #bfdbfe; border-left: 4px solid var(--primary);
  border-radius: 8px; padding: 10px 14px; margin: 12px 0 4px; font-size: 13.5px; color: var(--gray-700);
  line-height: 1.7;
}
.dim-def .label { font-size: 12px; font-weight: 700; color: var(--primary-dark); margin-bottom: 2px; letter-spacing: .5px; }
.dim-def .text { white-space: pre-wrap; word-break: break-word; }
.item-options {
  background: var(--gray-50); border: 1px dashed var(--gray-300); border-radius: 8px;
  padding: 12px 16px; font-size: 14px; color: var(--gray-600); white-space: pre-wrap; margin-bottom: 6px;
}

.rating-group { margin: 24px 0 4px; border-top: 1px solid var(--gray-200); padding-top: 18px; }
.rating-group .label { font-weight: 700; margin-bottom: 12px; font-size: 15px; }

/* 分区标题：左侧维度色强调条 */
.sec-label { display: flex; align-items: center; gap: 8px; }
.sec-label::before {
  content: ''; width: 4px; height: 16px; border-radius: 3px; flex-shrink: 0;
  background: var(--dimc, var(--primary));
}

.rating-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.rating-option {
  border: 1.5px solid var(--gray-300); border-radius: 10px; padding: 12px 8px; text-align: center;
  cursor: pointer; transition: all .15s; background: #fff;
  min-height: 96px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.rating-option .num { font-size: 24px; font-weight: 700; color: var(--gray-500); line-height: 1.2; }
.rating-option .desc { font-size: 12.5px; color: var(--gray-500); white-space: nowrap; }
.rating-option:hover { border-color: var(--primary); background: var(--primary-light); }
.rating-option.selected { border-color: var(--primary); background: var(--primary-light); box-shadow: 0 0 0 3px var(--primary-light); }
.rating-option.selected .num { color: var(--primary); }
.rating-option.selected[data-v="1"] { border-color: var(--red); }
.rating-option.selected[data-v="1"] .num { color: var(--red); }
.rating-option.selected[data-v="2"] { border-color: var(--amber); }
.rating-option.selected[data-v="2"] .num { color: var(--amber); }
.rating-option.selected[data-v="3"] { border-color: var(--green); }
.rating-option.selected[data-v="3"] .num { color: var(--green); }
.rating-option.selected[data-v="4"] { border-color: var(--green); }
.rating-option.selected[data-v="4"] .num { color: var(--green); }

.suggestion-group { margin-top: 22px; border-top: 1px solid var(--gray-200); padding-top: 18px; }
.suggestion-group .label { font-weight: 700; margin-bottom: 8px; font-size: 15px; color: var(--gray-800); }
.suggestion-group textarea {
  width: 100%; min-height: 90px; padding: 12px; border: 1.5px solid var(--gray-300);
  border-radius: 8px; resize: vertical; line-height: 1.7;
}
.suggestion-group textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.suggestion-hint { font-size: 12.5px; color: var(--gray-400); margin-top: 4px; }

.nav-btns { display: flex; justify-content: space-between; margin-top: 24px; gap: 10px; }
.nav-btns .spacer { flex: 1; }

.complete-banner {
  text-align: center; padding: 28px 20px; background: var(--green-light);
  border: 1px solid #bbf7d0; border-radius: var(--radius); margin-bottom: 20px;
}
.complete-banner .big { font-size: 20px; font-weight: 700; color: var(--green); margin-bottom: 6px; }
.complete-banner .small { color: var(--gray-600); font-size: 14px; }

/* ---- 弹窗 ---- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal { background: #fff; border-radius: 12px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: 86vh; overflow-y: auto; padding: 24px; }
.modal h3 { font-size: 17px; margin-bottom: 14px; color: var(--gray-900); }
.modal textarea { width: 100%; min-height: 110px; padding: 12px; border: 1.5px solid var(--gray-300); border-radius: 8px; resize: vertical; }
.modal .modal-btns { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---- Toast ---- */
#toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-80px);
  background: var(--gray-900); color: #fff; padding: 10px 22px; border-radius: 99px;
  font-size: 14px; z-index: 200; transition: transform .25s; box-shadow: var(--shadow-lg);
  pointer-events: none; opacity: 0;
}
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
#toast.err { background: var(--red); }

/* ---- 管理端 ---- */
.admin-topbar { background: var(--gray-900); color: #fff; padding: 0 24px; height: 56px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 30; }
.admin-topbar .brand { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.admin-topbar .brand .logo { width: 28px; height: 28px; border-radius: 7px; background: var(--primary); display: inline-flex; align-items: center; justify-content: center; font-size: 14px; }
.admin-topbar .right { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--gray-300); }

.admin-tabs {
  display: flex; gap: 4px; background: #fff; border-bottom: 1px solid var(--gray-200);
  padding: 0 24px; position: sticky; top: 56px; z-index: 20; overflow-x: auto;
}
.admin-tabs .tab {
  padding: 13px 16px; font-size: 14px; color: var(--gray-500); border-bottom: 2px solid transparent;
  cursor: pointer; white-space: nowrap; font-weight: 500;
}
.admin-tabs .tab:hover { color: var(--gray-800); }
.admin-tabs .tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.admin-body { padding: 20px 24px; max-width: 1400px; margin: 0 auto; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat-card .v { font-size: 26px; font-weight: 700; color: var(--gray-900); line-height: 1.2; }
.stat-card .k { font-size: 13px; color: var(--gray-500); margin-top: 4px; }
.stat-card.accent .v { color: var(--primary); }
.stat-card.green-card .v { color: var(--green); }

.section-title { font-size: 15px; font-weight: 700; color: var(--gray-800); margin: 22px 0 12px; display: flex; align-items: center; gap: 8px; }
.section-title .hint { font-size: 12.5px; color: var(--gray-400); font-weight: 400; }

table.data { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); overflow: hidden; font-size: 13.5px; }
table.data th {
  background: var(--gray-50); text-align: left; padding: 9px 12px; font-weight: 600;
  color: var(--gray-600); border-bottom: 1px solid var(--gray-200); white-space: nowrap; position: sticky;
}
table.data td { padding: 9px 12px; border-bottom: 1px solid var(--gray-100); vertical-align: top; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--gray-50); }
table.data .num { text-align: center; }
table.data .bad { color: var(--red); font-weight: 700; }
table.data .good { color: var(--green); font-weight: 700; }
table.data .warn { color: var(--amber); font-weight: 700; }
.item-text { max-width: 420px; white-space: pre-wrap; word-break: break-word; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .sep { width: 1px; height: 24px; background: var(--gray-200); }
.toolbar .grow { flex: 1; }

.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.form-row label { font-size: 13px; color: var(--gray-600); font-weight: 600; }
.form-row input[type=text], .form-row input[type=password], .form-row select {
  padding: 8px 12px; border: 1.5px solid var(--gray-300); border-radius: 8px; min-width: 140px;
}
.form-row input:focus, .form-row select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.form-row input.code { letter-spacing: 2px; text-transform: uppercase; }

.code-chip {
  display: inline-flex; align-items: center; gap: 6px; background: var(--gray-100);
  border: 1px dashed var(--gray-300); border-radius: 6px; padding: 2px 8px; font-family: Consolas, monospace;
  font-size: 13px; letter-spacing: 1px; color: var(--gray-800); cursor: pointer;
}
.code-chip:hover { background: var(--primary-light); border-color: var(--primary); }

.link-btn { color: var(--primary); cursor: pointer; font-size: 13px; background: none; border: none; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--red); }

.progress-mini { display: inline-flex; align-items: center; gap: 6px; }
.progress-mini .bar { width: 64px; height: 6px; background: var(--gray-200); border-radius: 99px; overflow: hidden; }
.progress-mini .bar > div { height: 100%; background: var(--primary); }

.empty { text-align: center; color: var(--gray-400); padding: 40px 0; font-size: 14px; }
.danger-zone { border: 1px solid #fecaca; background: var(--red-light); border-radius: var(--radius); padding: 18px; margin-top: 24px; }
.danger-zone h4 { color: var(--red); margin-bottom: 8px; font-size: 14px; }
.danger-zone p { color: var(--gray-600); font-size: 13px; margin-bottom: 12px; }

.note { background: var(--amber-light); border: 1px solid #fde68a; border-radius: 8px; padding: 10px 14px; font-size: 13px; color: #92400e; margin-bottom: 14px; }

/* ---- 题项切换动画（左右滑动） ---- */
@keyframes slideOutLeft { to { transform: translateX(-130%) rotate(-3deg); opacity: 0; } }
@keyframes slideOutRight { to { transform: translateX(130%) rotate(3deg); opacity: 0; } }
@keyframes slideInRight { from { transform: translateX(130%); opacity: 0; } }
@keyframes slideInLeft { from { transform: translateX(-130%); opacity: 0; } }
.item-card.anim-out-left { animation: slideOutLeft .24s ease forwards; }
.item-card.anim-out-right { animation: slideOutRight .24s ease forwards; }
.item-card.anim-in-right { animation: slideInRight .3s cubic-bezier(.2,.8,.3,1); }
.item-card.anim-in-left { animation: slideInLeft .3s cubic-bezier(.2,.8,.3,1); }
/* 桌面端切换：仅轻微淡入，无滑动特效 */
@keyframes fadeIn { from { opacity: 0; } }
.item-card.anim-fade { animation: fadeIn .18s ease; }

.mobile-only { display: none; }
.mobile-nav { display: none; }

/* ---- 手机端底部主菜单 ---- */
.mobile-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  align-items: stretch; justify-content: space-around;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--gray-200);
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 20px rgba(15,23,42,.07);
}
.mnav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: none; background: none; color: var(--gray-500); font-size: 11.5px; font-weight: 500;
  padding: 8px 4px; border-radius: 12px; transition: color .15s, background .15s;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.mnav-btn:active { background: var(--gray-100); }
.mnav-btn.mnav-main { color: #fff; background: var(--primary); box-shadow: 0 4px 14px rgba(37,99,235,.35); }
.mnav-btn.mnav-main:active { background: var(--primary-dark); }

/* ---- 目录抽屉 ---- */
.drawer-mask {
  position: fixed; inset: 0; z-index: 90; background: rgba(15,23,42,.45);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; transition: opacity .22s;
}
.drawer-mask.open { opacity: 1; }
.drawer {
  width: 100%; max-width: 640px; background: #fff; border-radius: 18px 18px 0 0;
  max-height: 78vh; display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform .28s cubic-bezier(.2,.8,.3,1);
  padding-bottom: env(safe-area-inset-bottom);
}
.drawer-mask.open .drawer { transform: translateY(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 8px; }
.drawer-title { font-size: 16px; font-weight: 700; color: var(--gray-900); }
.drawer-progress { font-size: 13px; color: var(--primary); font-weight: 600; margin-left: 6px; }
.drawer-close {
  border: none; background: var(--gray-100); width: 30px; height: 30px; border-radius: 50%;
  font-size: 13px; color: var(--gray-600); cursor: pointer;
}
.drawer-list { flex: 1; overflow-y: auto; padding: 4px 14px 10px; -webkit-overflow-scrolling: touch; }
.drawer-dim {
  display: flex; align-items: center; gap: 8px;
  font-size: 13.5px; color: var(--gray-700); font-weight: 700; padding: 12px 8px 4px;
}
.drawer-dim::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: var(--dimc, var(--gray-400));
}
.drawer-item {
  display: flex; gap: 10px; padding: 10px 8px; border-radius: 10px; cursor: pointer;
  border-bottom: 1px solid var(--gray-100); -webkit-tap-highlight-color: transparent;
}
.drawer-item:active { background: var(--gray-50); }
.drawer-item.active { background: var(--primary-light); }
.drawer-item .dot { margin-top: 6px; flex-shrink: 0; }
.drawer-item-main { min-width: 0; flex: 1; }
.drawer-item-no { font-size: 12px; color: var(--primary-dark); font-weight: 600; }
.drawer-item-text { font-size: 13.5px; color: var(--gray-700); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-foot { display: flex; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--gray-100); }

/* ---- 滑动切换辅助 ---- */
.swipe-zone { touch-action: pan-y; }
.swipe-hint { text-align: center; color: var(--gray-400); font-size: 12px; padding: 8px 0 2px; }

@media (max-width: 900px) {
  body { overscroll-behavior-y: none; -webkit-tap-highlight-color: transparent; }
  .workspace {
    flex-direction: column; padding: 12px 12px calc(84px + env(safe-area-inset-bottom));
    gap: 12px;
  }
  .sidebar { display: none; }
  .main { width: 100%; }
  .item-card { max-width: none; padding: 16px; }
  .rating-options { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .rating-option { padding: 12px 8px; min-height: 78px; }
  .rating-option .num { font-size: 22px; }
  .item-scroll { max-height: 32vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .nav-btns { display: none; }
  .mobile-nav { display: flex; }
  .mobile-only { display: block; }
  .desktop-only { display: none; }
  .topbar { height: auto; min-height: 56px; padding: calc(env(safe-area-inset-top)) 14px 0; }
  .topbar .brand-name { font-size: 15px; }
  .progress-strip { padding: 8px 14px; gap: 10px; }
  .item-content { font-size: 17px; line-height: 1.75; padding: 12px 14px; }
  .item-scroll .item-options { margin-top: 8px; }
  .suggestion-group textarea { min-height: 84px; }
  .complete-banner { max-width: none !important; }
  .login-card { padding: 32px 24px; }
  .admin-body { padding: 14px; }
}
