/* ============================================================
   设计令牌（PC ≥1200 / 平板 768–1199 / 手机 <768，对应 R10）
   ============================================================ */
:root {
  --brand: #2f5bea;
  --brand-strong: #1f45c9;
  --brand-soft: #eef2ff;
  --ink: #1b2130;
  --ink-2: #4b5563;
  --ink-3: #8a93a6;
  --line: #e6e9f0;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --success: #12805c;
  --success-soft: #e6f7f0;
  --warn: #b45309;
  --warn-soft: #fff5e6;
  --danger: #c02b2b;
  --danger-soft: #fdecec;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 12px 28px -18px rgba(16, 24, 40, .28);
  --shadow-lg: 0 24px 60px -30px rgba(16, 24, 40, .38);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-strong); }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

.container { width: min(1240px, calc(100% - 40px)); margin: 0 auto; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent;
  background: var(--brand); color: #fff; font-weight: 600; cursor: pointer;
  transition: transform .12s ease, background .16s ease, box-shadow .16s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--brand-strong); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink-2); border-color: var(--line); }
.btn.ghost:hover { background: #f2f4f8; color: var(--ink); }
.btn.subtle { background: var(--brand-soft); color: var(--brand-strong); }
.btn.subtle:hover { background: #e3e9ff; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #a32323; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn-link { background: none; border: 0; color: var(--brand); cursor: pointer; padding: 0; font-weight: 600; }

/* ---------------- 表单 ---------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.input, .select, .textarea {
  width: 100%; height: 42px; padding: 0 13px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; outline: none; transition: border .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 110px; padding: 10px 13px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47, 91, 234, .12);
}
.input::placeholder { color: #aab2c2; }
.hint { font-size: 12px; color: var(--ink-3); }
.error-text { font-size: 13px; color: var(--danger); min-height: 18px; }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 22px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.card-head h3 { font-size: 15px; }
.card-body { padding: 18px 20px; }

/* ---------------- 徽标 / 状态 ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px;
  border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef1f7; color: var(--ink-2);
}
.badge.brand { background: var(--brand-soft); color: var(--brand-strong); }
.badge.ok { background: var(--success-soft); color: var(--success); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow: auto; border-radius: var(--radius-sm); border: 1px solid var(--line); }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; background: #fff; }
table.data th, table.data td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); }
table.data th { background: #f8fafd; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #fafbff; }

/* ---------------- 顶栏 ---------------- */
.appbar {
  position: sticky; top: 0; z-index: 30; height: 62px;
  background: rgba(255, 255, 255, .86); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.appbar-inner { height: 62px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--ink); }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, #4f7bff, #2f5bea); color: #fff; font-size: 15px; font-weight: 800;
}
.nav-links { display: flex; gap: 4px; margin-left: 8px; }
.nav-links a {
  padding: 7px 13px; border-radius: 9px; color: var(--ink-2); font-size: 14px; font-weight: 500;
}
.nav-links a:hover { background: #f1f4fa; color: var(--ink); }
.nav-links a.active { background: var(--brand-soft); color: var(--brand-strong); font-weight: 600; }
.appbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-strong); font-weight: 700; font-size: 13px;
}
.user-menu { position: relative; }
.user-menu-panel {
  position: absolute; right: 0; top: 46px; width: 220px; padding: 8px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg);
  display: none;
}
.user-menu.open .user-menu-panel { display: block; }
.user-menu-panel .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.user-menu-panel a, .user-menu-panel button {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none;
  border-radius: 8px; font-size: 13.5px; color: var(--ink-2); cursor: pointer;
}
.user-menu-panel a:hover, .user-menu-panel button:hover { background: #f4f6fa; color: var(--ink); }

/* ---------------- 登录/注册 ---------------- */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.auth-side {
  background: radial-gradient(1000px 500px at 10% 0%, #dfe7ff 0%, #f4f7ff 45%, #fbfcff 100%);
  padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
}
.auth-side h1 { font-size: 34px; line-height: 1.3; margin-bottom: 14px; }
.auth-side .points { display: grid; gap: 14px; margin-top: 28px; }
.auth-side .point { display: flex; gap: 12px; align-items: flex-start; }
.auth-side .point i {
  width: 34px; height: 34px; border-radius: 10px; background: #fff; display: grid; place-items: center;
  box-shadow: var(--shadow); font-style: normal; font-size: 16px; flex: none;
}
.auth-main { display: grid; place-items: center; padding: 40px 24px; background: #fff; }
.auth-card { width: min(400px, 100%); }
.auth-card h2 { font-size: 24px; margin-bottom: 6px; }
.auth-card .sub { color: var(--ink-3); margin-bottom: 26px; }
.auth-foot { margin-top: 20px; font-size: 13px; color: var(--ink-3); }
.code-row { display: flex; gap: 8px; }
.code-row .btn { height: 42px; flex: none; min-width: 116px; }

/* ---------------- 首页 ---------------- */
.hero { padding: 92px 0 60px; background:
  radial-gradient(900px 420px at 80% -10%, #e2e9ff 0%, rgba(255,255,255,0) 60%),
  radial-gradient(700px 320px at 0% 0%, #eaf0ff 0%, rgba(255,255,255,0) 55%); }
.hero h1 { font-size: clamp(30px, 4vw, 46px); line-height: 1.24; max-width: 720px; }
.hero .lead { margin-top: 18px; font-size: 17px; color: var(--ink-2); max-width: 600px; }
.hero-actions { margin-top: 30px; display: flex; gap: 12px; flex-wrap: wrap; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 46px; max-width: 620px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.stat b { font-size: 26px; display: block; letter-spacing: -.02em; }
.stat span { font-size: 13px; color: var(--ink-3); }
.features { padding: 30px 0 80px; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feature { padding: 26px; }
.feature i { font-style: normal; font-size: 22px; display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 12px; background: var(--brand-soft); margin-bottom: 16px; }
.feature h3 { font-size: 16px; margin-bottom: 8px; }
.feature p { color: var(--ink-2); font-size: 14px; }
.site-footer { padding: 26px 0 40px; color: var(--ink-3); font-size: 13px; border-top: 1px solid var(--line); }

/* ---------------- 课表 ---------------- */
.page { padding: 26px 0 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 22px; }
.page-head p { color: var(--ink-3); font-size: 13.5px; margin-top: 4px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .select { width: auto; min-width: 150px; height: 38px; }

.layout-main { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
.timetable-card { overflow: hidden; }
.tt-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.week-switch { display: flex; align-items: center; gap: 6px; }
.week-switch button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.week-switch button:hover { background: #f4f6fa; }
.week-pill { min-width: 96px; text-align: center; font-size: 13.5px; font-weight: 600; }
.seg { display: inline-flex; background: #f1f4fa; border-radius: 9px; padding: 3px; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 7px; font-size: 13px; cursor: pointer; color: var(--ink-2); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(16,24,40,.08); font-weight: 600; }

.tt-grid { display: grid; grid-template-columns: 82px repeat(7, minmax(110px, 1fr)); }
.tt-grid > div { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-height: 84px; }
.tt-grid .tt-corner, .tt-grid .tt-day { min-height: 44px; background: #f8fafd; }
.tt-grid .tt-day { display: grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.tt-grid .tt-time { display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #fbfcff; font-size: 12px; color: var(--ink-2); gap: 2px; }
.tt-grid .tt-time b { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.tt-grid .tt-time span { color: var(--ink-3); font-size: 11px; white-space: nowrap; }
.tt-cell { padding: 6px; display: flex; flex-direction: column; gap: 5px; }
.course {
  border-radius: 9px; padding: 7px 9px; background: var(--brand-soft);
  border-left: 3px solid var(--brand); font-size: 12px; line-height: 1.45; color: #1e2a4a;
  cursor: default; overflow: hidden;
}
.course b { display: block; font-size: 12.5px; font-weight: 650; margin-bottom: 1px; }
.course span { display: block; color: #5a6784; font-size: 11.5px; }
.course.c1 { background: #eef4ff; border-color: #4285f4; }
.course.c2 { background: #eafaf3; border-color: #12a06b; }
.course.c3 { background: #fff4e8; border-color: #d97706; }
.course.c4 { background: #f7eeff; border-color: #8b5cf6; }
.course.c5 { background: #fdeef3; border-color: #db2777; }
.course.c6 { background: #e9f7fb; border-color: #0e9bb5; }
.tt-hint { display: none; padding: 8px 14px 0; }
@media (max-width: 720px) { .tt-hint { display: block; } }
.tt-empty { color: #c3cad8; font-size: 12px; display: grid; place-items: center; height: 100%; }
.semester-list { display: grid; gap: 10px; }
.semester-row { display: grid; grid-template-columns: 1fr 130px 1fr; gap: 12px; align-items: center;
  padding: 13px 16px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 13.5px; }
.semester-row .wk { color: var(--ink-3); font-size: 12.5px; }
.week-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: 11px; padding: 1px 6px; border-radius: 5px; background: #f1f4fa; color: var(--ink-2); }
.chip.on { background: var(--brand); color: #fff; }

.side-card { padding: 18px; }
.side-card h4 { font-size: 13px; color: var(--ink-3); font-weight: 600; margin-bottom: 10px; letter-spacing: .04em; }
.notice-item { padding: 11px 0; border-bottom: 1px dashed var(--line); }
.notice-item:last-child { border-bottom: 0; }
.notice-item b { font-size: 13.5px; display: block; margin-bottom: 3px; }
.notice-item p { font-size: 12.5px; color: var(--ink-2); }
.ad-box { border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #fff; }
.ad-box img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.ad-box .ad-text { padding: 10px 12px; font-size: 12.5px; }
.ad-label { font-size: 10px; color: var(--ink-3); padding: 4px 8px; display: block; }

/* ---------------- 个人中心 ---------------- */
.profile-grid { display: grid; grid-template-columns: 320px 1fr; gap: 20px; align-items: start; }
.profile-hero { padding: 26px; text-align: center; }
.profile-hero .avatar-lg {
  width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 14px; display: grid; place-items: center;
  background: linear-gradient(135deg, #4f7bff, #2f5bea); color: #fff; font-size: 26px; font-weight: 700;
}
.kv { display: grid; grid-template-columns: 84px 1fr; gap: 8px 12px; font-size: 13.5px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; color: var(--ink); }

/* ---------------- 通知 / 空态 ---------------- */
.notice-card { display: flex; gap: 14px; padding: 18px; align-items: flex-start; }
.notice-card .type { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-strong); flex: none; font-size: 17px; }
.notice-card h3 { font-size: 15px; margin-bottom: 4px; }
.rich { font-size: 14px; color: var(--ink-2); line-height: 1.75; }
.rich img { border-radius: 8px; margin: 8px 0; max-width: 100%; }
.empty { padding: 56px 20px; text-align: center; color: var(--ink-3); }
.empty b { display: block; color: var(--ink-2); margin-bottom: 4px; }

/* ---------------- Toast ---------------- */
.toast-wrap { position: fixed; top: 18px; right: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
  min-width: 220px; max-width: 360px; padding: 11px 15px; border-radius: 10px; background: #1f2937;
  color: #fff; font-size: 13.5px; box-shadow: var(--shadow-lg); animation: slideIn .18s ease;
}
.toast.ok { background: #0f7a58; } .toast.err { background: #b02a2a; } .toast.warn { background: #a86408; }
@keyframes slideIn { from { transform: translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------------- 弹窗 ---------------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(17, 24, 39, .45); z-index: 80;
  display: none; place-items: center; padding: 20px;
}
.modal-mask.open { display: grid; }
.modal { width: min(520px, 100%); background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); max-height: 88vh; overflow: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 20px 22px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.modal-close { border: 0; background: none; font-size: 20px; cursor: pointer; color: var(--ink-3); }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1199px) {
  .layout-main { grid-template-columns: 1fr 260px; }
  .tt-grid { grid-template-columns: 72px repeat(7, minmax(96px, 1fr)); }
}
@media (max-width: 900px) {
  .layout-main { grid-template-columns: 1fr; }
  .profile-grid { grid-template-columns: 1fr; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .nav-links { display: none; }
}
@media (max-width: 720px) {
  body { font-size: 14px; }
  .container { width: calc(100% - 24px); }
  .hero { padding: 56px 0 36px; }
  .stat-row { grid-template-columns: 1fr; gap: 10px; }
  .feature-grid { grid-template-columns: 1fr; }
  .tt-grid { grid-template-columns: 58px repeat(7, minmax(92px, 1fr)); }
  .tt-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .semester-row { grid-template-columns: 1fr; gap: 6px; }
  .page-head { align-items: flex-start; }
  .toolbar { width: 100%; }
  .toolbar .select { flex: 1; min-width: 0; }
  .card-pad { padding: 16px; }
}
