:root {
  --brand: #15304f;
  --brand-2: #1e4470;
  --gold: #b78a3c;
  --red: #c62828;
  --orange: #e07a1f;
  --blue: #2b6cb0;
  --ink: #16233a;
  --muted: #6b7a90;
  --line: #e2e8f1;
  --bg: #f3f6fa;
  --card: #fff;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

/* 顶栏 */
.topbar {
  height: 58px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  color: #fff;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.logo { font-size: 21px; font-weight: 800; letter-spacing: 3px; }
.sub { font-size: 12px; color: #b7c7dc; }
.role-switch { display: flex; gap: 8px; }
.role-btn {
  padding: 7px 16px; border-radius: 18px; cursor: pointer;
  border: 1px solid rgba(255,255,255,.35); background: transparent;
  color: #dbe6f4; font-size: 13px;
}
.role-btn.active { background: #fff; color: var(--brand); border-color: #fff; font-weight: 700; }

/* 布局 */
.shell { display: flex; min-height: calc(100vh - 58px); }
.side {
  width: 186px; flex: none; background: #fff; border-right: 1px solid var(--line);
  padding: 16px 10px; display: flex; flex-direction: column; gap: 4px;
}
.nav-item {
  padding: 11px 14px; border-radius: 9px; font-size: 14px; color: #41506a;
  cursor: pointer; display: flex; align-items: center; gap: 10px;
}
.nav-item .ic { width: 18px; text-align: center; opacity: .8; }
.nav-item:hover { background: #f2f6fb; }
.nav-item.active { background: var(--brand); color: #fff; font-weight: 700; }

.main { flex: 1; padding: 20px 24px 60px; max-width: 1300px; }
.view.hidden { display: none; }

/* 通用卡片 */
.panel {
  background: var(--card); border-radius: 14px; padding: 18px 20px; margin-bottom: 16px;
  box-shadow: 0 2px 10px rgba(18,35,58,.05);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; gap: 10px; }
.panel h2 { margin: 0; font-size: 16px; }
.muted { color: var(--muted); font-size: 12.5px; }

/* 首页数字 */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: #fff; border-radius: 14px; padding: 16px 18px; box-shadow: 0 2px 10px rgba(18,35,58,.05); }
.kpi b { display: block; font-size: 26px; color: var(--brand); }
.kpi span { font-size: 12px; color: var(--muted); }

/* 今日课程 */
.today-list { display: flex; flex-direction: column; gap: 10px; }
.today-item {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px;
  border-radius: 10px; background: #fbfcfe; border-left: 5px solid var(--brand);
}
.today-item.due { background: #fff8ef; border-left-color: var(--orange); }
.today-item.done { opacity: .55; }
.t-day { font-size: 12px; color: var(--muted); width: 92px; flex: none; }
.t-name { font-weight: 700; font-size: 15px; }
.t-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.t-tag { margin-left: auto; font-size: 11.5px; padding: 3px 9px; border-radius: 10px; background: #eef3f9; color: #41506a; }
.t-tag.due { background: var(--orange); color: #fff; }

/* 课表 */
.timetable { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.timetable th, .timetable td { border-bottom: 1px solid var(--line); }
.timetable thead th {
  background: #f7fafd; font-size: 12.5px; color: #41506a; padding: 10px 6px; font-weight: 700;
  border-top: 1px solid var(--line);
}
.timetable tbody th {
  width: 96px; font-size: 12px; color: var(--muted); font-weight: 400; padding: 8px 6px; text-align: left;
  background: #fbfcfe; line-height: 1.5;
}
.timetable td { height: 82px; vertical-align: top; padding: 4px; }
.cell {
  border-radius: 8px; padding: 7px 8px; height: 100%;
  background: #eef4fb; border-left: 4px solid var(--blue);
  font-size: 12px; line-height: 1.35;
}
.cell b { display: block; font-size: 12.5px; }
.cell .loc { color: #55627a; }
.cell .wk { display: inline-block; margin-top: 4px; font-size: 10.5px; padding: 1px 6px; border-radius: 8px; background: #fff; color: #41506a; border: 1px solid #dbe4f0; }
.cell.odd { background: #eef4fb; border-left-color: var(--blue); }
.cell.even { background: #f0fbf4; border-left-color: #2f8f5b; }
.cell.week { background: #fdf6ea; border-left-color: var(--gold); }

.filter-group { display: flex; gap: 8px; }
.chip {
  padding: 6px 13px; border-radius: 16px; border: 1px solid var(--line); background: #fff;
  font-size: 12.5px; cursor: pointer; color: #41506a;
}
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }

/* 表格 */
table.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.grid th, table.grid td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
table.grid thead th { background: #f7fafd; font-size: 12.5px; color: #41506a; }
table.grid tbody tr:hover { background: #fafcff; }
.grade-score { font-weight: 700; }
.grade-good { color: #2f8f5b; }
.grade-mid { color: var(--orange); }
.grade-bad { color: var(--red); }

/* 通知 */
.notice-list { display: flex; flex-direction: column; gap: 10px; }
.notice {
  border-radius: 10px; padding: 12px 14px 12px 16px; background: #fbfcfe;
  border: 1px solid var(--line); border-left: 6px solid var(--blue); cursor: pointer;
}
.notice.level-red { border-left-color: var(--red); background: #fff6f6; }
.notice.level-orange { border-left-color: var(--orange); background: #fffaf3; }
.notice.level-blue { border-left-color: var(--blue); }
.notice-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.notice-title { font-weight: 700; font-size: 15px; }
.notice-tag { font-size: 11px; padding: 2px 8px; border-radius: 10px; color: #fff; white-space: nowrap; }
.level-red .notice-tag { background: var(--red); }
.level-orange .notice-tag { background: var(--orange); }
.level-blue .notice-tag { background: var(--blue); }
.notice-meta { font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.notice-body { font-size: 13px; margin-top: 7px; color: #2c3a4f; line-height: 1.6; }
.notice.unread .notice-title::after { content: "· 未读"; color: var(--red); font-size: 11px; margin-left: 6px; }

/* 表单 */
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.form input, .form textarea, .form select {
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
  font-size: 13.5px; font-family: inherit; color: var(--ink); background: #fff;
}
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row label { flex: 1; min-width: 150px; }
.primary {
  align-self: flex-start; padding: 10px 24px; border-radius: 10px; border: none;
  background: var(--brand); color: #fff; font-size: 13.5px; font-weight: 700; cursor: pointer;
}
.ghost { padding: 8px 16px; border-radius: 9px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 13px; }

.stats { display: flex; gap: 26px; flex-wrap: wrap; }
.stat b { display: block; font-size: 22px; color: var(--brand); }
.stat span { font-size: 12px; color: var(--muted); }

.toast {
  position: fixed; right: 22px; bottom: 22px; background: var(--brand); color: #fff;
  padding: 12px 18px; border-radius: 10px; font-size: 13px; z-index: 99;
  box-shadow: 0 8px 24px rgba(0,0,0,.22);
}

/* ===== 扩展：标签、选课卡、聊天、状态 ===== */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab {
  padding: 6px 13px; border-radius: 16px; border: 1px solid var(--line); background: #fff;
  font-size: 12.5px; cursor: pointer; color: #41506a;
}
.tab.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }

.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.course-card {
  border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: #fff;
  display: flex; flex-direction: column; gap: 6px;
}
.course-card h4 { margin: 0; font-size: 15px; }
.course-card .meta { font-size: 12px; color: var(--muted); line-height: 1.5; }
.course-card .bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.badge { font-size: 11px; padding: 2px 9px; border-radius: 10px; background: #eef3f9; color: #41506a; }
.badge.ok { background: #e8f7ee; color: #2f8f5b; }
.badge.wait { background: #fff4e5; color: #b25b00; }
.badge.no { background: #fdecec; color: var(--red); }
.badge.type { background: #eaf1fb; color: var(--brand); }

.btn-sm {
  padding: 6px 14px; border-radius: 8px; border: 1px solid var(--brand);
  background: var(--brand); color: #fff; font-size: 12.5px; cursor: pointer;
}
.btn-sm.ghost { background: #fff; color: var(--brand); }
.btn-sm[disabled] { opacity: .45; cursor: not-allowed; }

/* 聊天 */
.chat-wrap { display: flex; flex-direction: column; height: 520px; }
.chat-log { flex: 1; overflow-y: auto; padding: 6px 4px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 78%; padding: 10px 13px; border-radius: 12px; font-size: 13.5px; line-height: 1.6; }
.msg.bot { background: #f1f6fc; color: #1d2c44; align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.me { background: var(--brand); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.chat-input { display: flex; gap: 10px; margin-top: 12px; }
.chat-input input {
  flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 11px 14px; font-size: 14px; font-family: inherit;
}
.quick { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.quick button {
  padding: 6px 12px; border-radius: 14px; border: 1px solid var(--line); background: #fff;
  font-size: 12px; cursor: pointer; color: #41506a;
}

/* 假条 */
.leave-item {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; background: #fbfcfe;
}
.leave-item .head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.leave-item .title { font-weight: 700; font-size: 14.5px; }
.leave-item .meta { font-size: 12px; color: var(--muted); margin-top: 5px; }

/* ===== 首页三板块 ===== */
.portal { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; margin-top: 8px; }
.portal-card {
  position: relative; border-radius: 18px; padding: 26px 24px; color: #fff; cursor: pointer;
  min-height: 230px; display: flex; flex-direction: column; justify-content: space-between;
  box-shadow: 0 10px 26px rgba(18,35,58,.14); overflow: hidden;
}
.portal-card.c1 { background: linear-gradient(140deg, #1b4d3e, #2f8f6b); }
.portal-card.c2 { background: linear-gradient(140deg, #15304f, #2b5c92); }
.portal-card.c3 { background: linear-gradient(140deg, #4a2f6e, #7a54a8); }
.portal-card h3 { margin: 0 0 8px; font-size: 24px; letter-spacing: 1px; }
.portal-card p { margin: 0; font-size: 13px; color: rgba(255,255,255,.82); line-height: 1.7; }
.portal-card .ic { font-size: 34px; margin-bottom: 14px; opacity: .9; }
.portal-card .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.portal-card .tags span { font-size: 11px; padding: 3px 9px; border-radius: 10px; background: rgba(255,255,255,.18); }
.portal-card:hover { transform: translateY(-3px); transition: .18s; }

.crumb {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-size: 13px; color: var(--muted);
}
.crumb button {
  border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 12px;
  font-size: 12.5px; cursor: pointer; color: #41506a;
}
.crumb b { color: var(--ink); font-size: 15px; }

/* 心理 / 后勤板块配色 */
.portal-card.c4 { background: linear-gradient(140deg, #4a2f6e, #8a6bc0); }
.portal-card.c5 { background: linear-gradient(140deg, #6b3a1f, #c08552); }
.portal { grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }
.portal-card { min-height: 215px; padding: 22px 20px; }
.portal-card h3 { font-size: 21px; }


/* ===== 板块底图 ===== */
body { background-color: #f2f5fb; transition: background-image .35s ease; }
body[data-domain="portal"] {
  background-image: radial-gradient(1200px 600px at 15% -10%, #e8efff 0%, transparent 60%),
                    radial-gradient(900px 500px at 90% 0%, #f3e9ff 0%, transparent 55%);
}
body[data-domain="campus"] {
  background-image: linear-gradient(rgba(255,255,255,.42), rgba(255,255,255,.58)), url("img/photo-run.jpg");
  background-size: cover, cover;
  background-position: center, center bottom;
  background-attachment: fixed, fixed;
}
body[data-domain="affairs"] {
  background-image: linear-gradient(rgba(255,255,255,.72), rgba(255,255,255,.82)), url("img/photo-campus.jpg");
  background-size: cover, cover;
  background-attachment: fixed, fixed;
}
body[data-domain="study"] {
  background-image: linear-gradient(rgba(255,255,255,.72), rgba(255,255,255,.86)), url("img/photo-study.jpg");
  background-size: cover, cover;
  background-attachment: fixed, fixed;
}
body[data-domain="psych"] {
  background-image: linear-gradient(rgba(248,244,255,.62), rgba(255,250,254,.78)), url("img/photo-psy.jpg");
  background-size: cover, cover;
  background-attachment: fixed, fixed;
}
body[data-domain="logistics"] {
  background-image: linear-gradient(rgba(255,255,255,.52), rgba(255,255,255,.74)), url("img/photo-log.jpg");
  background-size: cover, cover;
  background-attachment: fixed, fixed;
}

/* 卡片半透明，让底图透出来一点 */
.panel { background: rgba(255,255,255,.93); backdrop-filter: blur(6px); }
.side { background: rgba(255,255,255,.86); backdrop-filter: blur(8px); }
.life-card { background: rgba(255,255,255,.92); backdrop-filter: blur(6px); }

/* 校园跑 hero：跑道动效 */
.hero-run { position: relative; overflow: hidden; }
.hero-run::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 26px; height: 10px;
  background-image: repeating-linear-gradient(90deg, rgba(255,255,255,.9) 0 26px, transparent 26px 92px);
  background-size: 92px 100%;
  opacity: .16; animation: laneMove 2.6s linear infinite;
}
@keyframes laneMove { from { background-position-x: 0; } to { background-position-x: 84px; } }

/* 首页 hero 加一点颗粒感 */
.hero::after { mix-blend-mode: soft-light; }

/* hero 背景图（真实场景感） */
.hero-run {
  background-image: linear-gradient(90deg, rgba(13,55,34,.82) 0%, rgba(20,83,45,.55) 40%, rgba(20,83,45,.12) 100%), url("img/photo-run.jpg");
  background-size: cover, cover;
  background-position: center, center 78%;
}
.hero-psy {
  background-image: linear-gradient(90deg, rgba(58,38,88,.82) 0%, rgba(74,47,110,.5) 45%, rgba(138,107,192,.18) 100%), url("img/photo-psy.jpg");
  background-size: cover, cover;
  background-position: center, center 60%;
}
.hero-log {
  background-image: linear-gradient(90deg, rgba(90,45,14,.84) 0%, rgba(124,63,19,.55) 45%, rgba(192,133,82,.2) 100%), url("img/photo-log.jpg");
  background-size: cover, cover;
  background-position: center, center 65%;
}
