/* ============================================
   课题组管理系统 · 简约高级风格
   设计原则：克制配色 / 大量留白 / 细腻字体 / 极轻阴影
   ============================================ */

:root {
  --fg: #18181b;
  --muted: #6b7280;
  --line: #e9e9e7;
  --accent: #4f46e5;
  --accent-dark: #4338ca;
  --accent-ink: #3730a3;
  --accent-tint: #eef2ff;
  --bg: #fbfbfa;
  --card: #ffffff;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 15px;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent-tint); color: var(--accent-ink); }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }

/* ---------- 导航 ---------- */
/* ---------- 顶部导航：吸顶磨砂 + 胶囊标签页 ---------- */
.nav {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 960px; margin: 0 auto; padding: 0.55rem 1rem;
  display: flex; align-items: center; gap: 0.8rem;
}
.brand {
  display: flex; align-items: center; gap: 0.45rem;
  font-weight: 700; font-size: 0.98rem; letter-spacing: 0.01em;
  white-space: nowrap; color: var(--fg);
}
.brand-dot {
  width: 10px; height: 10px; border-radius: 3px;
  background: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint);
}
.nav-tabs {
  display: flex; gap: 0.15rem; align-items: center;
  overflow-x: auto; scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }
.nav-tab {
  white-space: nowrap; font-size: 0.9rem; color: var(--muted);
  padding: 0.34rem 0.85rem; border-radius: 999px;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-tab:hover { background: var(--accent-tint); color: var(--accent-ink); }
.nav-tab.active { background: var(--accent); color: #fff; font-weight: 600; }
.nav-right {
  margin-left: auto; display: flex; align-items: center; gap: 0.7rem;
  font-size: 0.84rem; white-space: nowrap;
}
.user-chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  background: #f4f4f5; border-radius: 999px; padding: 0.28rem 0.75rem;
  color: var(--fg); font-weight: 500;
}
.user-role { color: var(--muted); font-weight: 400; font-size: 0.78rem; }
.nav-right a { color: var(--muted); }
.nav-right a:hover { color: var(--accent); }
@media (max-width: 720px) {
  .nav-inner { flex-wrap: wrap; row-gap: 0.3rem; }
  .nav-tabs { order: 3; width: 100%; }
}

/* ---------- 页脚备案号 ---------- */
.site-footer { text-align: center; padding: 1.4rem 0 1.8rem; font-size: 0.78rem; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }

.container { max-width: 960px; margin: 2rem auto; padding: 0 1rem; }

h1 { font-size: 1.4rem; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 1.08rem; font-weight: 600; }
h3 { font-size: 0.95rem; font-weight: 600; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.5rem;
  margin-bottom: 1.4rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: opacity 0.15s ease;
}
.card.wv-loading { opacity: 0.55; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
@media (max-width: 720px) { .grid { grid-template-columns: 1fr; } }

.stack { display: flex; flex-direction: column; gap: 0.9rem; }

/* ---------- 表单 ---------- */
label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.9rem; }
input, select, textarea {
  font: inherit; padding: 0.5rem 0.7rem;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  color: var(--fg);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}
input::placeholder, textarea::placeholder { color: #a1a1aa; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block; font: inherit; font-weight: 500; cursor: pointer;
  background: var(--fg); color: #fff; border: none;
  border-radius: 8px; padding: 0.5rem 1.2rem; text-decoration: none;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.btn:hover { background: #000; color: #fff; }
.btn:active { transform: translateY(1px); }
.btn-outline {
  background: #fff; color: var(--fg); border: 1px solid var(--line);
}
.btn-outline:hover { background: #f4f4f5; color: var(--fg); }
.btn-danger { background: var(--err); }
.btn-danger:hover { background: #b91c1c; }
.btn-green { background: var(--ok); }
.btn-green:hover { background: #15803d; }
.btn-yellow { background: var(--warn); }
.btn-yellow:hover { background: #b45309; }

.btn:disabled, .btn:disabled:hover {
  background: #d4d4d8; color: #fff; cursor: not-allowed; transform: none;
}

/* ---------- 表格 ---------- */
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); }
th {
  color: var(--muted); font-weight: 500;
  font-size: 0.8rem; letter-spacing: 0.04em;
}
tbody tr { transition: background 0.12s ease; }
tbody tr:hover { background: #fafafa; }

/* ---------- 标签 ---------- */
.tag {
  display: inline-block; font-size: 0.76rem; font-weight: 500;
  padding: 0.08rem 0.55rem; border-radius: 999px;
  background: #f4f4f5; color: var(--fg);
}
.tag-approved, .tag-green { background: #ecfdf5; color: #15803d; }
.tag-pending, .tag-yellow { background: #fffbeb; color: #b45309; }
.tag-rejected, .tag-warn, .tag-red { background: #fef2f2; color: #b91c1c; }
.tag-none { background: #f4f4f5; color: #71717a; }

/* 学生端的导师评价标签：深色描边 + 浅色底，醒目但不刺眼 */
.tag-eval { font-size: 0.88rem; font-weight: 600; padding: 0.16rem 0.75rem; border: 1.5px solid transparent; }
.tag-eval.tag-green { background: #dcfce7; color: #15803d; border-color: #16a34a; }
.tag-eval.tag-yellow { background: #fef3c7; color: #b45309; border-color: #d97706; }
.tag-eval.tag-red { background: #fee2e2; color: #b91c1c; border-color: #dc2626; }
.tag-eval.tag-none { background: #f4f4f5; color: #52525b; border-color: #a1a1aa; }

/* ---------- 导师审阅页 ---------- */
.eval-bar {
  display: flex; flex-direction: column; gap: 0.7rem;
  background: #fafafa; border: 1px solid var(--line); border-radius: 10px;
  padding: 0.75rem 1rem; margin: 0.8rem 0 1.2rem;
}
.eval-status { font-size: 0.92rem; }
.eval-actions { display: inline-flex; gap: 0.5rem; margin-left: auto; }
.eval-form { display: inline; margin: 0; }
.eval-form2 {
  display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap;
  margin: 0; width: 100%;
}
.eval-comment {
  flex: 1 1 16rem;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 0.5rem 0.8rem; font-size: 0.9rem; background: #fff;
}
.eval-comment:focus { outline: 2px solid var(--accent-tint); border-color: var(--accent); }
.eval-cancel-form { width: auto; justify-content: flex-end; }
/* 学生端评阅意见：跟在评价标签下方 */
.eval-note { display: block; margin-top: 0.3rem; white-space: pre-wrap; }
.attach-frame {
  width: 100%; height: 72vh; border: 1px solid var(--line); border-radius: 10px;
  background: #fafafa;
}

/* ---------- 提示条 ---------- */
.flash {
  padding: 0.65rem 1rem; border-radius: 10px; margin-bottom: 1rem;
  font-size: 0.9rem;
  background: var(--accent-tint); border: 1px solid #c7d2fe; color: var(--accent-ink);
}
.flash-success { background: #ecfdf5; border-color: #a7f3d0; color: #166534; }
.flash-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.flash-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

.muted { color: var(--muted); font-size: 0.88rem; }
.pre { white-space: pre-wrap; }
.muted-row { opacity: 0.5; }

.review-item { border-top: 1px solid var(--line); padding-top: 0.8rem; margin-top: 0.8rem; }
.review-form { display: flex; gap: 0.5rem; align-items: center; }
.review-form input { flex: 1; }

.inline-form { display: flex; gap: 0.5rem; margin-bottom: 1rem; }

/* ============================================
   讨论时间表
   ============================================ */
.tt { display: flex; gap: 1.2rem; overflow-x: auto; padding-bottom: 0.4rem; }
.tt-day {
  flex: 1 0 17rem; max-width: 26rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}
.tt-head {
  padding: 0.85rem 1rem; text-align: center; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fafafa, #fff);
}
.tt-date { font-size: 1.05rem; font-weight: 600; }
.tt-dow { font-size: 0.8rem; color: var(--muted); letter-spacing: 0.03em; }

.tt-body { padding: 0.3rem 0.9rem 0.7rem 0; }
.tt-row { display: flex; align-items: stretch; border-top: 1px solid var(--line); min-height: 4.6rem; }
.tt-row.tt-end { min-height: 0; }
.tt-time { width: 4rem; flex: none; text-align: right; padding-right: 0.6rem; position: relative; }
.tt-time span {
  position: relative; top: -0.62em;
  font-size: 0.76rem; color: var(--muted); background: var(--card); padding: 0 0.15rem;
}

.tt-slot {
  flex: 1; margin: 0.45rem 0; border: none; border-radius: 10px;
  padding: 0.55rem 0.8rem; font: inherit; text-align: left;
  display: flex; flex-direction: column; justify-content: center; gap: 0.15rem;
  cursor: pointer; border-left: 4px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.tt-state { font-weight: 600; font-size: 0.9rem; }
.tt-topic {
  font-size: 0.78rem; color: #15803d;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.tt-open { background: var(--accent-tint); border-left-color: var(--accent); color: var(--accent-ink); }
.tt-open:hover {
  background: #e0e7ff; transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.16);
}
.tt-open:active { transform: translateY(0); }

.tt-mine { background: #ecfdf5; border-left-color: var(--ok); color: #166534; }
.tt-mine:hover {
  background: #d1fae5; transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(22, 163, 74, 0.14);
}

.tt-full { background: #f4f4f5; border-left-color: #d4d4d8; color: var(--muted); cursor: not-allowed; }
.tt-blocked { background: #fafafa; border-left-color: #e4e4e7; color: #a1a1aa; cursor: not-allowed; }

/* ============================================
   弹窗
   ============================================ */
.modal-mask {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 0, 0, 0.4);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  opacity: 0; transition: opacity 0.18s ease;
}
.modal-mask[hidden] { display: none; }
.modal-mask.show { opacity: 1; }
.modal {
  background: var(--card); border-radius: 14px; padding: 1.5rem 1.6rem;
  width: 100%; max-width: 26rem; box-shadow: 0 16px 48px rgba(0, 0, 0, 0.16);
  transform: translateY(10px) scale(0.97); transition: transform 0.18s ease;
}
.modal-mask.show .modal { transform: translateY(0) scale(1); }
.modal h2 { margin: 0 0 0.2rem; }
.modal-time { color: var(--muted); font-size: 0.88rem; margin: 0 0 0.9rem; }
.modal textarea { width: 100%; resize: vertical; min-height: 5.5rem; }
.modal-topic-view { margin-bottom: 0.4rem; }
.modal-topic-view p { margin: 0.25rem 0 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1rem; }
.modal-error, .form-error { margin: 0.7rem 0 0; font-size: 0.88rem; color: #b91c1c; }

/* ---------- 上传进度条 ---------- */
.up-progress {
  height: 6px; border-radius: 999px; background: var(--line);
  overflow: hidden; margin-top: 0.2rem;
}
.up-bar {
  height: 100%; width: 0; border-radius: 999px;
  background: var(--accent); transition: width 0.2s ease;
}

/* ---------- 请假历史记录展开详情 ---------- */
.history-row { cursor: pointer; }
.history-row:hover td { background: var(--accent-tint); }
.history-row.open td { background: var(--accent-tint); border-bottom-color: transparent; }
.leave-detail td { background: #fafafa; padding: 0.9rem 1.1rem; border-top: none; }
.ld-label { font-weight: 600; font-size: 0.82rem; color: var(--muted); }
.ld-reason { margin: 0.3rem 0 0; }
.ld-meta { margin: 0.5rem 0 0; color: var(--muted); font-size: 0.84rem; }

@media (max-width: 720px) {
  .tt { flex-direction: column; }
  .tt-day { max-width: none; }
}

/* ============================================
   周次选择器
   ============================================ */
.week-picker { position: relative; }
.week-picker input { cursor: pointer; text-align: center; min-width: 9.5rem; background: #fff; }
.wp-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 30;
  width: 19.5rem; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.1); padding: 0.8rem;
  animation: wp-in 0.15s ease;
}
@keyframes wp-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.wp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.4rem; }
.wp-head span { font-weight: 600; font-size: 0.92rem; }
.wp-nav {
  border: none; background: none; font-size: 1.2rem; line-height: 1;
  width: 2rem; height: 2rem; border-radius: 8px; cursor: pointer; color: var(--fg);
  transition: background 0.15s ease, color 0.15s ease;
}
.wp-nav:hover { background: var(--accent-tint); color: var(--accent); }
.wp-row { display: flex; border-radius: 8px; }
.wp-dow span { flex: 1; text-align: center; font-size: 0.74rem; color: var(--muted); padding: 0.2rem 0; }
.wp-day {
  flex: 1; border: none; background: none; font: inherit; font-size: 0.85rem;
  height: 2.1rem; cursor: pointer; border-radius: 8px; color: var(--fg); padding: 0;
  transition: color 0.12s ease;
}
.wp-out { color: #d4d4d8; }
.wp-row:hover { background: var(--accent-tint); }
.wp-row:hover .wp-day { color: var(--accent-ink); }
.wp-row.wp-sel { background: var(--accent); }
.wp-row.wp-sel .wp-day { color: #fff; font-weight: 600; }
.wp-row.wp-sel .wp-day.wp-out { color: rgba(255, 255, 255, 0.55); }
.wp-foot {
  margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--line);
  font-size: 0.78rem; color: var(--muted); text-align: center; min-height: 1.2em;
}

/* ============================================
   首页名单 / 取消预约
   ============================================ */
.name-list { font-size: 0.9rem; margin: 0.25rem 0; }
.names-ok { color: var(--ok); }
.names-miss { color: var(--err); font-weight: 500; }
.cancel-form { display: flex; gap: 0.4rem; }
.cancel-form input { flex: 1; min-width: 10rem; font-size: 0.85rem; padding: 0.35rem 0.55rem; }
.cancel-note {
  border-left: 4px solid var(--warn); background: #fffbeb;
  border-radius: 0 10px 10px 0;
}
.cancel-note p { margin: 0.2rem 0; font-size: 0.9rem; }
