:root {
  color-scheme: light;
  --paper: #f7f8f6;
  --white: #ffffff;
  --ink: #1d2b3a;
  --muted: #69788a;
  --line: #dbe2e8;
  --accent: #345bd4;
  --accent-quiet: #eaf0ff;
  --row-height: 64px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); }
button, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.shell { max-width: 1500px; margin: 0 auto; padding: 34px clamp(18px, 4vw, 58px) 44px; }
.masthead { border-bottom: 1px solid var(--line); padding-bottom: 28px; }
.eyebrow { margin: 0 0 12px; color: var(--accent); font-size: 13px; font-weight: 700; letter-spacing: .12em; }
.eyebrow span { color: #a2afba; margin: 0 7px; }
.masthead-line { display: flex; align-items: baseline; gap: 28px; }
.masthead h1 { margin: 0; font-size: clamp(38px, 4vw, 58px); line-height: 1.15; font-weight: 730; letter-spacing: -.045em; }
.masthead-line p { margin: 0; color: var(--muted); font-size: 15px; }

.week-panel { padding: 29px 0 20px; border-bottom: 1px solid var(--line); }
.week-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.week-stepper { display: flex; align-items: center; gap: 13px; }
.step-button { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); color: var(--ink); font-size: 28px; line-height: 1; display: grid; place-items: center; padding: 0 0 4px; transition: background .16s ease, border-color .16s ease, transform .16s ease; }
.step-button:hover:not(:disabled) { background: var(--accent-quiet); border-color: #b9c7ef; transform: translateY(-1px); }
.step-button:disabled { opacity: .38; }
.step-button:focus-visible, .week-chip:focus-visible, select:focus-visible { outline: 3px solid #a9bcfa; outline-offset: 2px; }
.week-readout { display: flex; align-items: baseline; gap: 5px; min-width: 145px; justify-content: center; white-space: nowrap; }
.week-readout span { color: var(--muted); font-size: 17px; }
.week-readout strong { font-size: 40px; line-height: 1; font-weight: 720; font-variant-numeric: tabular-nums; letter-spacing: -.05em; }
.week-jump { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.week-jump select { min-width: 118px; min-height: 40px; padding: 0 32px 0 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--white); color: var(--ink); }
.week-strip { display: flex; gap: 6px; margin-top: 24px; overflow-x: auto; padding: 2px 0 9px; scrollbar-width: none; }
.week-strip::-webkit-scrollbar { display: none; }
.week-chip { flex: 0 0 auto; width: 43px; height: 38px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; transition: background .16s ease, color .16s ease, transform .16s ease; }
.week-chip:hover { background: #e8edf3; color: var(--ink); transform: translateY(-1px); }
.week-chip[aria-pressed="true"] { background: var(--accent); color: var(--white); }
.week-summary { margin: 10px 0 0; min-height: 22px; color: var(--muted); font-size: 14px; }

.schedule-section { padding-top: 28px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; margin-bottom: 16px; }
.section-heading h2 { margin: 0; font-size: 23px; line-height: 1.3; font-weight: 680; letter-spacing: -.025em; }
.section-heading span { color: var(--muted); font-size: 13px; }
.desktop-board { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--white); }
.board-head, .board-body { display: grid; grid-template-columns: 64px repeat(5, minmax(0, 1fr)); }
.board-head { background: #eef2f5; border-bottom: 1px solid var(--line); }
.board-head span { min-width: 0; padding: 14px 10px; border-left: 1px solid var(--line); text-align: center; font-size: 13px; font-weight: 700; }
.board-head span:first-child { border-left: 0; color: var(--muted); }
.period-axis, .day-lane { display: grid; grid-template-rows: repeat(9, var(--row-height)); min-width: 0; }
.period-axis { grid-column: 1; background: #fafbfc; }
.period-tick { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-bottom: 1px solid var(--line); color: var(--muted); font-variant-numeric: tabular-nums; }
.period-tick strong { font-size: 13px; font-weight: 700; color: var(--ink); }
.period-tick small { font-size: 10px; line-height: 1.1; letter-spacing: -.01em; }
.period-tick:last-child, .slot:last-of-type { border-bottom: 0; }
.day-lane { border-left: 1px solid var(--line); }
.slot { border-bottom: 1px solid var(--line); min-height: 0; }
.course { z-index: 1; min-width: 0; margin: 5px; padding: 9px 10px 8px 11px; border-left: 3px solid var(--accent); border-radius: 7px; background: var(--accent-quiet); overflow: hidden; animation: appear .22s ease both; }
.course-name { margin: 0 0 5px; font-size: 14px; font-weight: 680; line-height: 1.27; overflow-wrap: anywhere; }
.course-meta, .course-room { margin: 0; font-size: 12px; line-height: 1.35; color: #506178; overflow-wrap: anywhere; }
.course-meta { margin-bottom: 2px; }
.course-room { color: #3958a4; }
.day-lane.is-empty { background: #fcfdfd; }
.mobile-agenda { display: none; }

.footer { display: flex; justify-content: space-between; gap: 20px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.6; }
.footer p { margin: 0; }
@keyframes appear { from { opacity: .15; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1180px) {
  .desktop-board { display: none; }
  .mobile-agenda { display: block; background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 0 20px; }
  .agenda-day { padding: 21px 0 5px; border-bottom: 1px solid var(--line); animation: appear .22s ease both; }
  .agenda-day:last-child { border-bottom: 0; }
  .agenda-day-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 13px; }
  .agenda-day h3 { margin: 0; font-size: 18px; font-weight: 700; }
  .agenda-day-count { color: var(--muted); font-size: 12px; }
  .agenda-list { margin: 0; padding: 0; list-style: none; }
  .agenda-item { display: grid; grid-template-columns: 83px minmax(0, 1fr); gap: 13px; padding: 14px 0; border-top: 1px solid #edf0f3; }
  .agenda-period { color: var(--accent); font-size: 13px; font-weight: 700; line-height: 1.5; white-space: nowrap; }
  .agenda-name { margin: 0 0 8px; font-size: 16px; line-height: 1.4; font-weight: 680; overflow-wrap: anywhere; }
  .agenda-detail { margin: 2px 0 0; color: #536276; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
  .agenda-code { color: #8793a0; font-size: 12px; font-weight: 600; }
  .agenda-empty { margin: 0 0 18px; color: #9aa5ae; font-size: 14px; }
}

@media (max-width: 640px) {
  .shell { padding: 25px 16px 30px; }
  .masthead { padding-bottom: 23px; }
  .eyebrow { font-size: 11px; letter-spacing: .075em; }
  .masthead-line { display: block; }
  .masthead h1 { font-size: 39px; }
  .masthead-line p { margin-top: 10px; font-size: 13px; }
  .week-panel { padding-top: 23px; }
  .week-toolbar { gap: 10px; }
  .week-stepper { gap: 5px; }
  .step-button { width: 34px; height: 36px; font-size: 24px; }
  .week-readout { min-width: 101px; gap: 3px; }
  .week-readout strong { font-size: 32px; }
  .week-readout span { font-size: 14px; }
  .week-jump span { display: none; }
  .week-jump select { min-width: 95px; min-height: 36px; padding-left: 8px; font-size: 12px; }
  .week-strip { margin-top: 20px; }
  .week-chip { width: 40px; height: 37px; }
  .schedule-section { padding-top: 24px; }
  .section-heading h2 { font-size: 20px; }
  .mobile-agenda { padding: 0 15px; }
  .agenda-day { padding-top: 18px; }
  .agenda-item { grid-template-columns: 72px minmax(0, 1fr); gap: 9px; }
  .footer { display: block; }
  .footer p + p { margin-top: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Academic dates, holiday changes, and month view */
:root { --row-height: 88px; }
.week-range { margin: 9px 0 0 107px; color: var(--muted); font-size: 13px; }
.week-jump select { min-width: 170px; }
.week-notices { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.week-notices:empty { display: none; }
.notice { padding: 6px 9px; border-radius: 6px; font-size: 12px; line-height: 1.35; }
.notice-holiday { color: #8b5c37; background: #fff1e5; }
.notice-makeup { color: #234fa8; background: #e6efff; }
.view-switch { display: inline-flex; align-items: center; padding: 3px; background: #e9edf1; border-radius: 10px; }
.view-tab { min-width: 82px; height: 34px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: 13px; font-weight: 650; transition: background .16s ease, color .16s ease; }
.view-tab[aria-pressed="true"] { background: var(--white); color: var(--ink); box-shadow: 0 1px 3px rgba(29,43,58,.09); }
.view-tab:focus-visible, .today-button:focus-visible, .calendar-day:focus-visible { outline: 3px solid #a9bcfa; outline-offset: 2px; }
#weekly-view[hidden], #calendar-view[hidden] { display: none !important; }
.board-head, .board-body { grid-template-columns: 58px repeat(7, minmax(0, 1fr)); }
.board-head { min-height: 71px; }
.board-head .head-axis { display: grid; place-items: center; }
.board-head .head-day { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 8px 4px; }
.head-day strong { font-size: 13px; line-height: 1.2; }
.head-day small { color: #687b8f; font-size: 11px; font-weight: 500; }
.head-day em { color: #96603d; font-size: 10px; line-height: 1.2; font-style: normal; font-weight: 700; }
.board-head .head-holiday { background: #fff0e5; }
.board-head .head-makeup { background: #e6efff; }
.board-head .head-makeup em { color: #315ab2; }
.day-lane.is-weekend { background: #fafbfc; }
.day-lane.is-holiday { background: #fffaf5; }
.day-lane.is-makeup { background: #f7faff; }
.course { margin: 4px; padding: 7px 7px 7px 8px; }
.course-name { font-size: 13px; margin-bottom: 4px; }
.course-meta, .course-room { font-size: 11px; }
.course--makeup { border-left-color: #2248a7; background: #dfeaff; }
.closed-overlay, .quiet-overlay { z-index: 1; grid-row: 1 / span 9; display: flex; align-items: center; justify-content: center; padding: 12px; color: #9d7c64; text-align: center; font-size: 13px; line-height: 1.5; white-space: pre-line; }
.quiet-overlay { color: #7083a1; }
.agenda-day-title { display: flex; align-items: baseline; gap: 10px; }
.agenda-date { color: var(--muted); font-size: 13px; }
.agenda-makeup .agenda-day-count { color: #2b55af; }
.agenda-holiday .agenda-day-count { color: #9d6747; }
.agenda-note { margin: -4px 0 14px; color: #64748b; font-size: 12px; line-height: 1.5; }
.agenda-holiday { background: rgba(158, 103, 71, 0.07); border-radius: 10px; padding-left: 13px; padding-right: 8px; margin-left: -13px; margin-right: -8px; }
.agenda-makeup { background: rgba(43, 85, 175, 0.06); border-radius: 10px; padding-left: 13px; padding-right: 8px; margin-left: -13px; margin-right: -8px; }
.calendar-view { background: transparent; }
.calendar-toolbar { display: flex; align-items: center; gap: 10px; margin: 1px 0 18px; }
.calendar-toolbar h3 { min-width: 138px; margin: 0; text-align: center; font-size: 20px; font-weight: 700; }
.today-button { margin-left: auto; min-height: 37px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); color: var(--ink); font-size: 12px; }
.today-button:hover:not(:disabled) { background: var(--accent-quiet); }
.today-button:disabled { opacity: .42; cursor: not-allowed; }
.calendar-weekdays, .month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-weekdays { color: var(--muted); text-align: center; font-size: 12px; font-weight: 700; }
.calendar-weekdays span { padding: 0 0 9px; }
.month-grid { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--white); }
.calendar-day { min-width: 0; min-height: 110px; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; padding: 11px 12px; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--white); text-align: left; color: var(--ink); transition: background .14s ease; }
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day:hover:not(:disabled) { background: #f1f5ff; }
.calendar-day.is-outside { color: #aeb7c2; background: #fafbfc; }
.calendar-day.is-holiday { background: #fff7f0; }
.calendar-day.is-makeup { background: #edf3ff; }
.calendar-day.is-selected { box-shadow: inset 0 0 0 2px var(--accent); z-index: 1; }
.calendar-day.is-today .calendar-day-top strong { color: var(--accent); }
.calendar-day:disabled { cursor: default; }
.calendar-day-top { display: flex; align-items: baseline; justify-content: space-between; gap: 3px; }
.calendar-day-top strong { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.calendar-day-top small { color: #97a4b2; font-size: 10px; white-space: nowrap; }
.calendar-day-bottom { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-end; gap: 4px; min-width: 0; min-height: 18px; }
.calendar-tag { align-self: flex-start; padding: 3px 5px; border-radius: 4px; color: #915c37; background: #ffeadb; font-size: 10px; line-height: 1; font-weight: 700; white-space: nowrap; }
.is-makeup .calendar-tag { color: #2752ac; background: #d8e5ff; }
.calendar-course { display: -webkit-box; min-width: 0; padding: 3px 5px; border-radius: 4px; overflow: hidden; color: #3159b1; background: #e7efff; font-size: 10px; line-height: 1.3; font-weight: 700; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.calendar-legend { display: flex; align-items: center; gap: 18px; margin: 13px 0 22px; color: var(--muted); font-size: 12px; }
.calendar-legend span { display: inline-flex; align-items: center; gap: 6px; }
.calendar-legend i { width: 9px; height: 9px; display: inline-block; border-radius: 50%; }
.legend-dot { background: var(--accent); }
.legend-holiday { background: #d59e70; }
.legend-makeup { background: #85a8f2; }
.day-detail { border-top: 1px solid var(--line); padding-top: 21px; }
.detail-head { display: flex; justify-content: space-between; align-items: start; gap: 20px; }
.detail-heading h3 { margin: 0; font-size: 20px; font-weight: 700; }
.detail-heading p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.detail-status { padding: 6px 9px; border-radius: 5px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.detail-holiday { color: #8b5c37; background: #fff1e5; }
.detail-makeup { color: #234fa8; background: #e6efff; }
.detail-note { margin: 14px 0 0; color: #53647a; font-size: 13px; }
.detail-list { margin: 15px 0 0; padding: 0; list-style: none; max-width: 760px; }
.detail-list .agenda-item { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 13px; padding: 14px 0; border-top: 1px solid #e8edf2; }
.detail-list .agenda-period { color: var(--accent); font-size: 13px; font-weight: 700; white-space: nowrap; }
.detail-list .agenda-name { margin: 0 0 5px; font-size: 15px; font-weight: 680; }
.detail-list .agenda-detail { margin: 0; color: #536276; font-size: 13px; }
.detail-list .agenda-code { margin: 4px 0 0; color: #8997a5; font-size: 11px; }
.detail-empty { margin: 16px 0 0; color: #8c98a4; font-size: 14px; }
.footer a { color: #3159b1; text-decoration: underline; text-underline-offset: 2px; }

@media (max-width: 1180px) {
  .agenda-day-title { gap: 10px; }
  .agenda-note { margin: -2px 0 12px; }
}

@media (max-width: 640px) {
  .week-range { margin: 8px 0 0 75px; font-size: 12px; }
  .week-jump select { min-width: 92px; max-width: 105px; }
  .week-notices { margin-top: 8px; }
  .notice { font-size: 11px; }
  .section-heading h2 { font-size: 19px; }
  .view-tab { min-width: 64px; height: 33px; font-size: 12px; }
  .agenda-day-title { display: block; }
  .agenda-date { display: block; margin-top: 2px; font-size: 12px; }
  .calendar-toolbar { gap: 6px; }
  .calendar-toolbar .step-button { width: 30px; height: 32px; }
  .calendar-toolbar h3 { min-width: 110px; font-size: 16px; }
  .today-button { min-height: 32px; padding: 0 8px; font-size: 11px; }
  .calendar-day { min-height: 67px; gap: 4px; padding: 5px 4px; }
  .calendar-day-top strong { font-size: 13px; }
  .calendar-day-top small { display: none; }
  .calendar-day-bottom { min-height: 14px; gap: 3px; }
  .calendar-tag, .calendar-course { padding: 2px 3px; font-size: 9px; }
  .calendar-legend { gap: 10px; font-size: 11px; }
  .detail-heading h3 { font-size: 17px; }
  .detail-list .agenda-item { grid-template-columns: 77px minmax(0, 1fr); }
}

/* 今天定位与节次时间 */
.head-day.head-today { background: #e8f0ff; }
.head-day .head-today-mark { color: #315ab2; }
.day-lane.is-today { background: rgba(52, 91, 212, 0.05); }
.agenda-day.is-today { background: rgba(52, 91, 212, 0.07); box-shadow: inset 3px 0 0 var(--accent); border-radius: 10px; padding-left: 13px; padding-right: 8px; margin-left: -13px; margin-right: -8px; }
.agenda-today-badge { padding: 2px 8px; border-radius: 999px; background: var(--accent); color: var(--white); font-size: 11px; font-weight: 700; line-height: 1.4; }
.agenda-time { display: block; color: var(--muted); font-size: 11px; font-weight: 600; line-height: 1.4; }

/* 节次时间表 */
.period-times { display: grid; grid-template-columns: repeat(auto-fill, minmax(97px, 1fr)); gap: 6px; margin: 0 0 18px; }
.period-time { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 4px 7px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); }
.period-time strong { font-size: 12px; line-height: 1.2; font-weight: 700; }
.period-time small { color: var(--muted); font-size: 11px; line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap; }
.period-time.is-now { border-color: var(--accent); background: #eef3ff; box-shadow: inset 0 0 0 1px var(--accent); }

/* 倒计时标题 */
.countdown { font-variant-numeric: tabular-nums; line-height: 1.15; }
.countdown-when { margin-right: 10px; }
.countdown-time { color: var(--accent); }
.countdown-course { display: block; margin-top: 7px; color: var(--muted); font-size: 15px; font-weight: 600; letter-spacing: 0; line-height: 1.4; }

.period-note { margin: -6px 0 14px; color: var(--muted); font-size: 11px; line-height: 1.55; }

.export-row { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; }
.export-btn { padding: 9px 14px; border-radius: 10px; background: var(--accent); color: var(--white); font-size: 13px; font-weight: 700; text-decoration: none; line-height: 1.3; }
.export-btn:active { opacity: .85; }
.export-link { color: var(--muted); font-size: 12px; }

/* 我的日程 */
.personal-section { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); }
.personal-heading { margin: 0 0 10px; font-size: 15px; font-weight: 700; }
.personal-item { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.personal-item:last-of-type { border-bottom: 0; }
.personal-time { flex: 0 0 auto; color: var(--accent); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.personal-body { flex: 1; min-width: 0; }
.personal-name { margin: 0 0 3px; font-size: 14px; font-weight: 650; line-height: 1.35; overflow-wrap: anywhere; }
.personal-loc, .personal-note-text { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.4; overflow-wrap: anywhere; }
.personal-edit { flex: 0 0 auto; padding: 4px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); color: var(--muted); font-size: 12px; }
.personal-add { width: 100%; margin-top: 10px; padding: 10px; border: 1px dashed var(--accent); border-radius: 10px; background: #f4f7ff; color: var(--accent); font-size: 13px; font-weight: 700; }
.personal-empty { margin: 0 0 4px; color: var(--muted); font-size: 13px; }
.agenda-add { margin-left: auto; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); color: var(--accent); font-size: 12px; font-weight: 700; }
.personal-tag { display: inline-block; margin-top: 2px; padding: 1px 7px; border-radius: 999px; background: #eef3ff; color: var(--accent); font-size: 10px; font-weight: 700; }
.personal-list .agenda-item { cursor: pointer; }

/* 日程编辑对话框 */
.event-box { width: min(92vw, 430px); }
.event-fields { display: flex; flex-direction: column; gap: 12px; margin: 14px 0 18px; }
.event-label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.event-input { min-height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); color: var(--ink); font-size: 15px; font-family: inherit; }
.event-input:focus { outline: 2px solid #a9bcfa; border-color: var(--accent); }
.event-row { display: flex; gap: 12px; }
.event-row .event-label { flex: 1; }
