/* ============ 课题组协作平台 v5 · 学术文档风（纯白/全衬线/三线表） ============ */
:root {
  --paper: #ffffff;
  --paper-deep: #f2f2f2;
  --card: #ffffff;
  --ink: #111111;
  --text: #222222;
  --muted: #666666;
  --faint: #999999;
  --rule: #cccccc;
  --rule-soft: #e5e5e5;
  --accent: #1155aa;      /* 经典学术蓝 */
  --accent-soft: #eef3fa;
  --ok: #2e6e4f;  --ok-bg: #ecf4ef;
  --bad: #b04038; --bad-bg: #f9edeb;
  --warn: #8f6c1f; --warn-bg: #f9f3e2;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", Georgia, serif;
}

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

body {
  font-family: var(--serif);
  background: var(--paper);
  color: var(--text);
  font-size: 15px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cfcfcf; }
::-webkit-scrollbar-thumb:hover { background: #b0b0b0; }

a { color: var(--accent); text-decoration: underline; }

/* ============ 布局 ============ */
.layout { display: flex; min-height: 100vh; }

.side {
  width: 228px;
  flex: none;
  background: #ffffff;
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  padding: 24px 16px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 8px 20px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 16px;
}
.side-mark {
  width: 38px; height: 38px;
  background: var(--ink);
  color: #fff;
  font-size: 19px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.side-name { color: var(--ink); font-weight: 600; font-size: 15.5px; letter-spacing: .08em; }
.side-sub { font-size: 11px; color: var(--faint); margin-top: 2px; letter-spacing: .06em; }

.side-nav { display: flex; flex-direction: column; }
.side-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-left: 3px solid transparent;
  text-decoration: none;
  font-size: 14px;
  color: #444;
}
.side-nav a:hover { color: var(--ink); background: #f7f7f7; }
.side-nav a.active {
  border-left-color: var(--ink);
  color: var(--ink);
  font-weight: 600;
  background: transparent;
}

.side-user {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--rule);
  padding: 14px 4px 4px;
}
.side-user-info { flex: 1; min-width: 0; }
.side-user-info b { color: var(--ink); font-size: 13.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.avatar {
  width: 34px; height: 34px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--ink);
  font-weight: 600;
  font-size: 14px;
}
.avatar.teacher { background: var(--accent); }
.avatar.sm { width: 26px; height: 26px; font-size: 12px; }

.role { font-size: 11px; padding: 0 7px; border: 1px solid var(--rule); color: var(--muted); }
.role.teacher { border-color: #a9c2e2; color: var(--accent); }

.icon-btn {
  border: none; background: transparent; color: var(--faint); cursor: pointer;
  padding: 6px; display: inline-flex;
}
.icon-btn:hover { background: #f0f0f0; color: var(--ink); }
.icon-btn.danger { color: var(--bad); }
.icon-btn.danger:hover { background: var(--bad-bg); }

.main { flex: 1; min-width: 0; padding: 32px 36px 64px; }
.container { max-width: 920px; margin: 0 auto; }

/* ============ 页头 ============ */
.page-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 22px; border-bottom: 1px solid var(--rule); padding-bottom: 12px; }
.page-head h1 { font-size: 22px; font-weight: 600; color: var(--ink); letter-spacing: .1em; }
.page-head .muted { margin-top: 3px; }
.page-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ============ 卡片 ============ */
.card {
  background: var(--card);
  border: 1px solid var(--rule);
  padding: 20px 22px;
  margin-bottom: 16px;
}
.table-card { padding: 16px 18px 18px; }
.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: .12em;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.muted { color: var(--muted); font-size: 13px; }

/* ============ 统计 ============ */
.stat-row { display: flex; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.stat {
  flex: 1; min-width: 150px;
  background: var(--card);
  border: 1px solid var(--rule);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 13px;
}
.stat-ic {
  width: 38px; height: 38px; flex: none;
  background: var(--paper-deep);
  color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
}
.stat.ok .stat-ic { background: var(--ok-bg); color: var(--ok); }
.stat.warn .stat-ic { background: var(--warn-bg); color: var(--warn); }
.stat.bad .stat-ic { background: var(--bad-bg); color: var(--bad); }
.stat .num { font-size: 24px; font-weight: 600; line-height: 1.2; color: var(--ink); }
.stat .lbl { font-size: 13px; color: var(--muted); }

/* ============ 表单 ============ */
label.field { display: block; margin-bottom: 13px; font-size: 14px; font-weight: 500; }
label.field span { display: flex; align-items: center; gap: 5px; margin-bottom: 6px; color: var(--ink); }

input[type=text], input[type=password], input[type=number], textarea, select {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid #b8b8b8;
  font-size: 14.5px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(17, 85, 170, .12);
}
textarea { resize: vertical; min-height: 92px; line-height: 1.85; }
textarea.tall { min-height: 124px; }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 18px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background .1s;
  text-decoration: none;
}
.btn.primary { background: var(--ink); color: #fff; }
.btn.primary:hover { background: #000; }
.btn.primary:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--ink); border-color: #999; }
.btn.ghost:hover { border-color: var(--ink); background: #fff; }
.btn.ghost:disabled { opacity: .45; cursor: not-allowed; }
.btn.block { width: 100%; justify-content: center; padding: 10px; font-size: 15px; }
.btn.sm { padding: 4px 11px; font-size: 13px; }

/* ============ 徽章 ============ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 500;
  padding: 1px 8px;
  white-space: nowrap;
}
.badge.big { font-size: 12.5px; padding: 3px 10px; border: 1px solid var(--rule); background: #fff; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.miss { background: var(--bad-bg); color: var(--bad); }
.badge.cat { background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.plain { background: var(--paper-deep); color: var(--muted); }
.badge.wait { background: var(--paper-deep); color: var(--muted); }

/* ============ 表格：三线表 ============ */
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 12px; }
th {
  color: var(--ink);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  background: transparent;
}
td { border-bottom: 1px solid var(--rule-soft); }
tr:last-child td { border-bottom: 2px solid var(--ink); }
table tr:hover td { background: #f7f9fb; }

.fname { display: flex; align-items: center; gap: 10px; }
.ext {
  width: 38px; height: 24px; flex: none;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  color: var(--muted);
  font-size: 9.5px; font-weight: 700; letter-spacing: .02em;
  display: inline-flex; align-items: center; justify-content: center;
}
a.dl { color: var(--accent); text-decoration: underline; font-weight: 500; }
.file-actions { display: flex; gap: 4px; justify-content: flex-end; }
.icode {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 2px 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .05em;
}

/* ============ 周报 ============ */
.report-sec { margin-bottom: 13px; }
.report-sec h4 {
  font-size: 13px; color: var(--ink); font-weight: 600;
  margin-bottom: 3px; letter-spacing: .1em;
}
.report-sec p { white-space: pre-wrap; font-size: 14.5px; }

.comment-box {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding: 11px 14px;
  margin-bottom: 14px;
}
.comment-box .from {
  font-size: 13px; color: var(--accent); font-weight: 600;
  margin-bottom: 4px; display: flex; align-items: center; gap: 5px;
}

.history-item { border: 1px solid var(--rule); margin-bottom: 12px; }
.history-item summary {
  padding: 9px 14px;
  cursor: pointer;
  background: var(--paper-deep);
  display: flex; align-items: center; gap: 10px;
  font-weight: 500; font-size: 14px;
  list-style: none; user-select: none;
}
.history-item summary::-webkit-details-marker { display: none; }
.history-item summary::before { content: '▸'; color: var(--muted); }
.history-item[open] summary::before { content: '▾'; }
.history-item summary:hover { background: #e9e9e9; }
.history-body { padding: 14px 17px; }

/* ============ 附件 ============ */
.attach-box { border: 1px dashed #a8a8a8; padding: 12px 14px; background: #fcfcfc; }
.attach-head { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; margin-bottom: 10px; }
.attach-head .muted { font-weight: 400; flex: 1; }
.attach-list { display: flex; flex-wrap: wrap; gap: 8px; }
.attach-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: #fff;
  border: 1px solid var(--rule);
  padding: 5px 9px;
  font-size: 13.5px;
  max-width: 100%;
}
.attach-chip .dl { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-chip i { font-style: normal; color: var(--faint); font-size: 12px; white-space: nowrap; }
.attach-chip .pwd { color: var(--warn); }
.chip-x {
  border: none; background: transparent; color: var(--faint);
  cursor: pointer; padding: 2px; display: inline-flex;
}
.chip-x:hover { background: var(--bad-bg); color: var(--bad); }

/* ============ 上传 ============ */
.upload-meta { display: flex; gap: 10px; margin-bottom: 13px; flex-wrap: wrap; }
.upload-meta select { width: 120px; flex: none; }
.upload-meta input[type=text] { flex: 1; min-width: 180px; }
.upload-meta input[type=number] { width: 90px; flex: none; }

.dropzone {
  border: 1.5px dashed #a8a8a8;
  padding: 28px 20px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  background: #fcfcfc;
}
.dropzone:hover, .dropzone.drag {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.dz-icon {
  width: 46px; height: 46px;
  background: #fff;
  border: 1px solid var(--rule);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 9px;
  color: var(--ink);
}
.dropzone b { color: inherit; }

.upload-item { display: flex; align-items: center; gap: 12px; padding: 9px 4px; font-size: 14px; }
.upload-item .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item .state { font-size: 13px; color: var(--muted); white-space: nowrap; width: 110px; text-align: right; }
.upload-item .state.done { color: var(--ok); }
.upload-item .state.err { color: var(--bad); }
.progress { width: 190px; height: 5px; background: var(--paper-deep); overflow: hidden; flex: none; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .2s; }

.filter-bar { display: flex; gap: 8px; margin-bottom: 13px; flex-wrap: wrap; }
.chip {
  padding: 4px 14px;
  border: 1px solid #999;
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--ink);
  font-family: inherit;
}
.chip:hover { border-color: var(--ink); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ============ 弹窗 ============ */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(17, 17, 17, .45);
  display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 20px;
}
.modal {
  background: #fff;
  border: 1px solid var(--rule);
  width: 620px; max-width: 100%; max-height: 85vh;
  overflow: auto;
  padding: 20px 24px 24px;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 15px; padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}
.modal-head .icon-btn:hover { background: var(--paper-deep); }

/* ============ 登录页 ============ */
.auth { display: flex; min-height: 100vh; }

.auth-art {
  flex: 1.15;
  position: relative; overflow: hidden;
  background: linear-gradient(155deg, #1e2530 0%, #171c24 45%, #10141b 100%);
  color: #edf0f4;
  display: flex; align-items: center;
}
.sky { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 46%; }
.auth-art-text { position: relative; padding: 0 64px; max-width: 560px; }
.auth-logo {
  width: 52px; height: 52px;
  background: rgba(237, 240, 244, .08);
  border: 1px solid rgba(237, 240, 244, .25);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 22px;
}
.auth-art h1 { font-size: 27px; font-weight: 600; letter-spacing: .1em; margin-bottom: 9px; }
.auth-art p { color: #98a2b0; font-size: 15px; letter-spacing: .06em; }
.auth-chips { display: flex; gap: 8px; margin-top: 22px; }
.auth-chips span {
  font-size: 12.5px; padding: 4px 14px;
  border: 1px solid rgba(237, 240, 244, .25);
  color: #b6bfcb;
}

.auth-panel { width: 470px; flex: none; background: #fff; display: flex; align-items: center; justify-content: center; padding: 40px; border-left: 1px solid var(--rule); }
.auth-box { width: 100%; max-width: 330px; }

.tabs { display: flex; border-bottom: 1px solid var(--rule); margin-bottom: 22px; }
.tabs button {
  flex: 1; background: none; border: none; padding: 11px;
  font-size: 15px; color: var(--muted);
  cursor: pointer; border-bottom: 2px solid transparent;
  font-weight: 500; font-family: inherit;
}
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--ink); border-bottom-color: var(--ink); }

.demo-hint {
  margin-top: 20px; font-size: 12.5px; color: var(--muted);
  background: var(--paper-deep);
  border: 1px dashed #aaa; padding: 10px 13px; line-height: 2;
}
.demo-hint code { background: #fff; border: 1px solid var(--rule); color: var(--ink); padding: 1px 6px; font-size: 11.5px; font-family: Consolas, monospace; }

/* ============ 主页维护（表单） ============ */
.hp-tabs { display: flex; border: 1px solid var(--rule); margin-bottom: -1px; width: fit-content; background: #fff; }
.hp-tabs button {
  border: none; background: #fff;
  padding: 8px 22px; font-size: 13.5px; font-family: inherit;
  font-weight: 500; color: var(--muted); cursor: pointer;
}
.hp-tabs button.active { background: var(--ink); color: #fff; }
.hp-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; padding: 7px 0; border-bottom: 1px dashed var(--rule-soft); }
.hp-row:last-child { border-bottom: none; }
.hp-field { display: flex; flex-direction: column; gap: 3px; min-width: 120px; }
.hp-field > span { font-size: 11.5px; color: var(--muted); font-weight: 500; padding-left: 2px; }
.hp-field input, .hp-field textarea { font-size: 13.5px; padding: 6px 9px; }
.hp-field textarea { line-height: 1.7; min-height: 64px; resize: vertical; }
.hp-idx { flex: none; width: 24px; height: 28px; display: inline-flex; align-items: center; justify-content: center; font-size: 11.5px; color: var(--faint); margin-top: 14px; }
.hp-del { margin-top: 10px; }
.hp-list-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.hp-list-head .muted { flex: 1; }
#hp-preview { width: 100%; height: 620px; border: 1px solid var(--rule); background: #fff; }
textarea.code {
  font-family: Consolas, Menlo, "Courier New", monospace;
  font-size: 12.5px; line-height: 1.6; min-height: 460px;
  white-space: pre; overflow-x: auto; tab-size: 2;
}

/* ============ 其他 ============ */
.empty { text-align: center; color: var(--muted); padding: 34px 0 26px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty svg { opacity: .3; }

#toast-box { position: fixed; top: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--ink); color: #fff;
  padding: 10px 18px; font-size: 14px;
  animation: slidein .25s; max-width: 340px;
}
.toast.ok { background: var(--ok); }
.toast.err { background: var(--bad); }
@keyframes slidein { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ============ 响应式 ============ */
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; padding: 10px 14px; gap: 10px; }
  .side-brand { border: none; padding: 0; margin: 0; }
  .side-sub { display: none; }
  .side-nav { flex-direction: row; flex: 1; }
  .side-nav a span { display: none; }
  .side-nav a { padding: 8px; border-left: none; border-bottom: 3px solid transparent; }
  .side-nav a.active { border-bottom-color: var(--ink); }
  .side-user { margin: 0; padding: 4px; border: none; }
  .side-user-info { display: none; }
  .main { padding: 20px 16px 50px; }
  .auth-art { display: none; }
  .auth-panel { width: 100%; border: none; }
}
