@font-face {
  font-family: "Semester Sans";
  src: url("./fonts/semester-sans.woff2") format("woff2");
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  --page: #ffffff;
  --surface: #ffffff;
  --surface-soft: #ffffff;
  --ink: #202124;
  --ink-soft: #6b7280;
  --ink-faint: #9ca3af;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --ai: #b74b5d;
  --ai-soft: #f9edef;
  --drug: #77529c;
  --drug-soft: #f3eef7;
  --bigdata: #2e756f;
  --bigdata-soft: #ebf4f2;
  --bioinfo: #4f68a0;
  --bioinfo-soft: #eef1f7;
  --holiday: #75647f;
  --holiday-soft: #f7f3f8;
  --current-week: #8da0cb;
  --current-week-ink: #53658d;
  --current-week-soft: #f3f5fa;
  --topbar: rgba(255, 255, 255, 0.94);
  --board-header: rgba(255, 255, 255, 0.96);
  --board-header-sticky: rgba(255, 255, 255, 0.98);
  --week-label: #ffffff;
  --weekend: #ffffff;
  --brand-ink: #4f5d56;
  --control-ink: #4c534f;
  --text-strong: #343a36;
  --event-ink: #3f4642;
  --event-meta: #626b66;
  --detail-ink: #424a45;
  --dialog-shadow: rgba(31, 37, 33, 0.18);
  --dialog-backdrop: rgba(27, 31, 28, 0.3);
  --aiworkflow-gradient: linear-gradient(
    92deg,
    #3fa5cc 0%,
    #67a4af 10%,
    #9aa982 20%,
    #ceb153 30%,
    #f1a730 40%,
    #f37c23 50%,
    #f55116 60%,
    #f03425 70%,
    #ea1738 80%,
    #d6165c 90%,
    #c31d7c 100%
  );
}

* { box-sizing: border-box; }
html { background: var(--page); scroll-behavior: smooth; }

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: "Semester Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font: inherit; }
.app-frame { width: min(1680px, 100%); min-height: 100vh; margin: 0 auto; background: var(--surface); }

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: grid;
  height: 72px;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: var(--topbar);
  backdrop-filter: blur(14px);
}

.brand-block { grid-column: 2; min-width: 0; justify-self: center; }
.brand-copy { display: flex; align-items: center; gap: 14px; white-space: nowrap; }
.brand-unit { display: inline-flex; align-items: baseline; gap: 9px; }
.brand-title {
  color: #3fa5cc;
  background: var(--aiworkflow-gradient);
  background-clip: text;
  font-size: 23px;
  font-weight: 560;
  letter-spacing: 0.055em;
  line-height: 1.2;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-scope { color: var(--ink); font-size: 23px; font-weight: 620; letter-spacing: 0.045em; }
.brand-english {
  color: #3fa5cc;
  background: var(--aiworkflow-gradient);
  background-clip: text;
  font-family: "AI Workflow Display", "Semester Sans", sans-serif;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-unit-primary .brand-english { font-size: 23px; }
.brand-unit-scope .brand-english { font-size: 23px; }
.brand-divider { width: 1px; height: 22px; flex: 0 0 auto; background: var(--line-strong); }
.topbar-actions { display: flex; grid-column: 3; align-items: center; justify-self: end; gap: 7px; }

.toolbar-button {
  display: inline-flex;
  height: 34px;
  align-items: center;
  gap: 6px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--control-ink);
  background: var(--surface);
  cursor: pointer;
  font-size: 12px;
  transition: background 140ms ease, border-color 140ms ease;
}
.toolbar-button:hover { border-color: color-mix(in srgb, var(--ink-soft) 48%, var(--line)); background: var(--surface-soft); }
.toolbar-button svg { width: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle { width: 34px; justify-content: center; padding: 0; }
.theme-toggle .sun-icon { display: none; }
[data-calendar-theme="dark"] .theme-toggle .moon-icon { display: none; }
[data-calendar-theme="dark"] .theme-toggle .sun-icon { display: block; }
[data-theme-source="fixed"] .theme-toggle { display: none; }
.weekend-toggle .weekend-arrow { transition: transform 160ms ease; transform-origin: 17px 12px; }
.weekend-toggle[aria-expanded="false"] { border-color: color-mix(in srgb, var(--current-week) 64%, var(--line)); color: var(--current-week-ink); }
.weekend-toggle[aria-expanded="false"] .weekend-arrow { transform: rotate(180deg); }
.toolbar-button:focus-visible, .text-button:focus-visible, .filter-chip:focus-visible, .event-chip:focus-visible, .agenda-event:focus-visible, .dialog-close:focus-visible { outline: 2px solid color-mix(in srgb, var(--bigdata) 42%, transparent); outline-offset: 2px; }

.workspace { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: calc(100vh - 72px); }
.sidebar { border-right: 1px solid var(--line); background: var(--surface); }
.sidebar-section { padding: 22px 20px; border-bottom: 1px solid var(--line); }
.sidebar-term-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 22px; color: var(--ink-soft); font-size: 11px; font-weight: 540; white-space: nowrap; }
.sidebar-term-meta span:last-child { font-weight: 620; }
.side-label { margin: 0; color: var(--ink-faint); font-size: 11px; font-weight: 650; letter-spacing: 0.06em; }
.tomorrow-heading, .side-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.tomorrow-heading { align-items: flex-end; }
.tomorrow-title-group { display: grid; gap: 4px; }
.tomorrow-kicker { color: var(--ink-faint); font-size: 10px; font-weight: 650; letter-spacing: 0.08em; }
.tomorrow-heading h2 { margin: 0; color: var(--text-strong); font-size: 14px; font-weight: 660; letter-spacing: -0.015em; line-height: 1.35; }
.tomorrow-state { flex: 0 0 auto; padding-bottom: 1px; color: #777d78; font-size: 11px; font-weight: 600; }
.tomorrow-state.has-class { color: #496a64; }
.tomorrow-body:empty { display: none; }
.tomorrow-body:not(:empty) { margin-top: 15px; }
.tomorrow-empty { margin: 0; color: var(--text-strong); font-size: 16px; font-weight: 560; line-height: 1.5; }
.tomorrow-events { display: grid; gap: 12px; }
.tomorrow-event { display: grid; grid-template-columns: 48px 1fr; gap: 9px; align-items: start; }
.tomorrow-time { padding: 4px 5px; border-radius: 5px; color: var(--course-ink); background: var(--course-soft); font-size: 10px; font-weight: 700; text-align: center; }
.tomorrow-event strong { display: block; font-size: 12px; font-weight: 650; line-height: 1.45; }
.tomorrow-event span:last-child { display: block; margin-top: 2px; color: var(--ink-soft); font-size: 10px; line-height: 1.45; }
.next-class { margin-top: 17px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--ink-soft); line-height: 1.45; }
.next-class:empty { display: none; }
.next-class-heading { margin-bottom: 10px; color: var(--ink-faint); font-size: 10px; font-weight: 650; letter-spacing: 0.08em; }
.next-class-row { display: grid; grid-template-columns: 72px minmax(0, 1fr); align-items: start; gap: 10px; }
.next-class-date { display: grid; gap: 2px; color: var(--ink-soft); font-style: normal; }
.next-class-date strong { color: var(--text-strong); font-size: 11px; font-weight: 650; white-space: nowrap; }
.next-class-date span { font-size: 10px; font-weight: 520; }
.next-class-detail { min-width: 0; padding-left: 10px; border-left: 2px solid color-mix(in srgb, var(--course-color) 72%, var(--line)); }
.next-class-course { display: block; overflow: hidden; color: var(--text-strong); font-size: 12px; font-weight: 650; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.next-class-meta { display: flex; flex-wrap: wrap; gap: 3px 10px; margin-top: 3px; color: var(--ink-soft); font-size: 10px; font-weight: 520; }
.side-heading { align-items: center; }
.text-button { padding: 0; border: 0; color: var(--ink-soft); background: transparent; cursor: pointer; font-size: 10px; }
.text-button:hover { color: var(--ink); }

.filter-group { display: grid; gap: 5px; margin-top: 13px; }
.filter-chip { display: grid; grid-template-columns: 24px 1fr; width: 100%; min-height: 38px; align-items: center; gap: 9px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; color: var(--text-strong); background: transparent; cursor: pointer; font-size: 11px; text-align: left; transition: border-color 130ms ease, opacity 130ms ease; }
.filter-chip:hover, .filter-chip[aria-pressed="true"] { border-color: color-mix(in srgb, var(--course-color) 48%, #e1e4e8); }
.filter-chip[aria-pressed="false"] { opacity: 0.38; }
.filter-symbol { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 6px; color: var(--course-ink); background: var(--course-soft); font-size: 9px; font-weight: 750; }

.main-panel { min-width: 0; padding: 14px 28px 30px; background: var(--surface); }
.calendar-heading { display: flex; min-height: 62px; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.calendar-overline { margin: 0 0 6px; color: var(--ink-faint); font-size: 10px; letter-spacing: 0.03em; }
h1 { margin: 0; font-size: 24px; font-weight: 650; letter-spacing: -0.035em; line-height: 1.2; }
.calendar-description { margin: 0 0 2px; color: var(--ink-soft); font-size: 11px; }
.desktop-calendar { position: relative; overflow-x: auto; overflow-y: hidden; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); scrollbar-width: none; -ms-overflow-style: none; }
.desktop-calendar::-webkit-scrollbar { display: none; width: 0; height: 0; }
.semester-board { min-width: 1080px; }
.board-row { display: grid; grid-template-columns: 66px repeat(7, minmax(0, 1fr)); }
html[data-weekends="collapsed"] .semester-board { min-width: 820px; }
html[data-weekends="collapsed"] .board-row { grid-template-columns: 66px repeat(5, minmax(0, 1fr)); }
html[data-weekends="collapsed"] .weekend-column,
html[data-weekends="collapsed"] .day-cell.weekend { display: none; }
.week-row { position: relative; height: 82px; }
.week-row.has-todo,
.week-row.has-todo .week-label,
.week-row.has-todo .day-cell { height: auto; min-height: 82px; }
.board-row + .board-row { border-top: 1px solid var(--line); }
.board-header { position: sticky; z-index: 8; top: 0; color: var(--ink-soft); background: var(--board-header); backdrop-filter: blur(10px); }
.board-header > div { display: flex; height: 40px; align-items: center; justify-content: center; gap: 5px; border-left: 1px solid var(--line); font-size: 10px; font-weight: 620; }
.weekend-mark { padding-left: 5px; border-left: 1px solid var(--line-strong); color: var(--ink-faint); font-size: 8px; font-weight: 560; }
.board-header > div:first-child { position: sticky; z-index: 10; left: 0; border-left: 0; background: var(--board-header-sticky); }
.week-label { position: sticky; z-index: 5; left: 0; display: flex; height: 82px; min-height: 0; flex-direction: column; align-items: center; justify-content: center; background: var(--week-label); box-shadow: 1px 0 0 var(--line); }
.week-label strong { font-size: 16px; font-weight: 650; }
.week-label span { max-width: 58px; margin-top: 4px; color: var(--ink-faint); font-size: 8px; line-height: 1.35; text-align: center; }
.week-row.is-current::after { position: absolute; z-index: 12; inset: -1px; border: 2px solid color-mix(in srgb, var(--current-week) 72%, transparent); content: ""; pointer-events: none; }
.week-row.is-current .week-label { color: var(--current-week-ink); background: var(--current-week-soft); box-shadow: 1px 0 0 var(--line); }
.week-row.is-current .week-label span { color: #7783a0; }

.day-cell { position: relative; height: 82px; min-width: 0; min-height: 0; padding: 3px 5px; overflow: hidden; border-left: 1px solid var(--line); background: var(--surface); }
.day-cell.weekend { background: var(--weekend); }
.day-cell.holiday { background: var(--holiday-soft); }
.day-cell.today {
  z-index: 13;
  isolation: isolate;
  background:
    linear-gradient(
      135deg,
      rgba(141, 211, 199, 0.18) 0%,
      rgba(128, 177, 211, 0.13) 28%,
      rgba(190, 186, 218, 0.17) 52%,
      rgba(244, 202, 228, 0.15) 76%,
      rgba(253, 205, 172, 0.14) 100%
    );
}
.day-cell.today::before {
  position: absolute;
  z-index: 13;
  inset: 0;
  padding: 2px;
  background: conic-gradient(
    from 215deg,
    #8dd3c7,
    #80b1d3,
    #bebada,
    #f4cae4,
    #fdb462,
    #fb8072,
    #8dd3c7
  );
  content: "";
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: 0.9;
  pointer-events: none;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
}
.day-meta { display: flex; min-height: 14px; align-items: center; justify-content: space-between; gap: 4px; margin-bottom: 2px; }
.date-label { color: #747b76; font-size: 9px; font-weight: 560; }
.today .date-label { color: var(--current-week-ink); font-weight: 700; }
.today .day-meta::after { color: #69789c; content: "今天"; font-size: 8px; font-weight: 600; }
.holiday-label { overflow: hidden; color: var(--holiday); font-size: 8px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.cell-events { display: grid; gap: 2px; }
.event-chip { position: relative; display: block; width: 100%; min-width: 0; padding: 2px 4px 2px 7px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--course-color) 26%, var(--surface)); border-radius: 5px; color: var(--event-ink); background: var(--course-soft); cursor: pointer; text-align: left; transition: filter 120ms ease; }
.event-chip::before { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; background: var(--course-color); content: ""; }
.event-chip:hover { filter: saturate(1.18) brightness(0.985); }
.event-chip strong, .event-chip span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-chip strong { color: var(--course-ink); font-size: 10px; font-weight: 680; line-height: 1.2; }
.event-chip span { margin-top: 0; color: var(--event-meta); font-size: 9px; line-height: 1.2; }
.event-chip .event-summary { display: flex; align-items: center; overflow: hidden; }
.event-chip .event-summary > span { min-width: 0; flex: 0 0 auto; }
.event-chip .event-summary > span + span { position: relative; flex: 1 1 auto; margin-left: 5px; padding-left: 6px; }
.event-chip .event-summary > span + span::before { position: absolute; top: 2px; bottom: 2px; left: 0; width: 1px; background: color-mix(in srgb, var(--course-color) 38%, transparent); content: ""; }
.event-chip.is-hidden { display: none; }
.todo-chip {
  display: grid;
  width: 100%;
  min-width: 0;
  height: 17px;
  grid-template-columns: 3px auto minmax(0, 1fr);
  align-items: center;
  gap: 4px;
  padding: 0 4px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--todo-color) 38%, var(--line));
  border-radius: 4px;
  color: var(--event-ink);
  background: color-mix(in srgb, var(--todo-color) 11%, var(--surface));
  cursor: pointer;
  text-align: left;
}
.todo-chip:hover { background: color-mix(in srgb, var(--todo-color) 18%, var(--surface)); }
.todo-mark { width: 3px; height: 9px; border-radius: 2px; background: var(--todo-color); }
.todo-time { color: var(--event-meta); font-size: 8px; font-weight: 650; white-space: nowrap; }
.todo-chip strong { overflow: hidden; font-size: 10px; font-weight: 680; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.todo-chip.is-done { opacity: 0.58; }
.todo-chip.is-done strong { text-decoration: line-through; }
.exam-week .week-label::after { margin-top: 4px; color: #917249; content: "考试"; font-size: 7px; }
.exam-mark { margin-left: 7px; padding-left: 7px; border-left: 1px solid var(--line-strong); color: var(--holiday); font-style: normal; font-weight: 600; }

.calendar-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 13px; color: var(--ink-soft); font-size: 9px; }
.calendar-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch { display: inline-block; width: 13px; height: 9px; border-radius: 3px; }
.holiday-swatch { border: 1px solid #ded3e3; background: var(--holiday-soft); }
.today-swatch {
  border: 1px solid #d9ddea;
  background: linear-gradient(135deg, rgba(141, 211, 199, 0.55), rgba(190, 186, 218, 0.55), rgba(244, 202, 228, 0.5), rgba(253, 205, 172, 0.48));
}
.todo-swatch { border: 1px solid #d8d3e3; background: linear-gradient(90deg, #bebada 0 25%, #f7f5fa 25%); }
.overlap-swatch { background: linear-gradient(180deg, var(--ai) 0 45%, transparent 45% 55%, var(--drug) 55% 100%); }
.timezone-note { margin-left: auto; }
.mobile-agenda { display: none; }

.event-dialog { width: min(460px, calc(100% - 30px)); padding: 0; border: 1px solid var(--line-strong); border-radius: 12px; color: var(--ink); background: var(--surface); box-shadow: 0 20px 70px var(--dialog-shadow); }
.event-dialog::backdrop { background: var(--dialog-backdrop); }
.dialog-close { position: absolute; z-index: 2; top: 13px; right: 13px; display: grid; width: 30px; height: 30px; place-items: center; border: 1px solid var(--line); border-radius: 7px; color: var(--ink-soft); background: var(--surface); cursor: pointer; font-size: 18px; }
.dialog-hero { padding: 25px 54px 20px 24px; background: var(--course-soft); }
.dialog-symbol { display: grid; width: 27px; height: 27px; place-items: center; margin-bottom: 12px; border-radius: 6px; color: #fff; background: var(--course-color); font-size: 9px; font-weight: 750; }
.dialog-hero h2 { margin: 0; font-size: 19px; font-weight: 650; line-height: 1.35; }
.dialog-date { display: flex; align-items: center; gap: 8px; margin: 7px 0 0; color: var(--course-color); font-size: 11px; font-weight: 620; }
.dialog-date span + span { padding-left: 8px; border-left: 1px solid color-mix(in srgb, var(--course-color) 48%, transparent); }
.dialog-details { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 22px 24px 25px; }
.detail-item span { display: block; margin-bottom: 5px; color: var(--ink-faint); font-size: 9px; }
.detail-item strong { display: block; color: var(--detail-ink); font-size: 12px; font-weight: 600; line-height: 1.5; }
.todo-dialog-hero .dialog-symbol { background: var(--todo-color); }
.todo-note-detail { grid-column: 1 / -1; }
.todo-note-detail strong { white-space: pre-wrap; }
.tomorrow-todo.is-done { opacity: 0.62; }
.tomorrow-todo.is-done strong { text-decoration: line-through; }

[data-calendar-theme="dark"] {
  color-scheme: dark;
  --page: #1b1d27;
  --surface: #222530;
  --surface-soft: #272a36;
  --ink: #f1f0f4;
  --ink-soft: #adb1c0;
  --ink-faint: #7f8596;
  --line: #343846;
  --line-strong: #444958;
  --holiday: #c8add1;
  --holiday-soft: #302b39;
  --current-week: #aeb9e4;
  --current-week-ink: #d4daf3;
  --current-week-soft: #2d3141;
  --topbar: rgba(27, 29, 39, 0.93);
  --board-header: rgba(34, 37, 48, 0.96);
  --board-header-sticky: rgba(34, 37, 48, 0.98);
  --week-label: #222530;
  --weekend: #20232d;
  --brand-ink: #cbd0dc;
  --control-ink: #d8dae2;
  --text-strong: #e3e5ea;
  --event-ink: #eef0f5;
  --event-meta: #c1c5d0;
  --detail-ink: #e2e4e9;
  --dialog-shadow: rgba(0, 0, 0, 0.42);
  --dialog-backdrop: rgba(8, 9, 13, 0.62);
}

[data-calendar-theme="dark"] .tomorrow-state { color: #9da2b1; }
[data-calendar-theme="dark"] .tomorrow-state.has-class { color: #9ed1c7; }
[data-calendar-theme="dark"] .pending-note { color: #e3bd83; }
[data-calendar-theme="dark"] .week-row.is-current .week-label span { color: #aeb7d5; }
[data-calendar-theme="dark"] .date-label { color: #a5aab8; }
[data-calendar-theme="dark"] .today .day-meta::after { color: #c3cae8; }
[data-calendar-theme="dark"] .day-cell.today {
  background:
    linear-gradient(
      135deg,
      rgba(141, 211, 199, 0.12) 0%,
      rgba(128, 177, 211, 0.09) 28%,
      rgba(190, 186, 218, 0.12) 52%,
      rgba(244, 202, 228, 0.10) 76%,
      rgba(253, 205, 172, 0.09) 100%
    ),
    var(--surface);
}
[data-calendar-theme="dark"] .filter-symbol,
[data-calendar-theme="dark"] .tomorrow-time,
[data-calendar-theme="dark"] .event-chip,
[data-calendar-theme="dark"] .agenda-event,
[data-calendar-theme="dark"] .agenda-todo,
[data-calendar-theme="dark"] .dialog-hero {
  color: color-mix(in srgb, var(--course-color) 74%, white);
  background: color-mix(in srgb, var(--course-color) 13%, var(--surface));
}
[data-calendar-theme="dark"] .event-chip,
[data-calendar-theme="dark"] .agenda-event {
  border-color: color-mix(in srgb, var(--course-color) 33%, var(--surface));
}
[data-calendar-theme="dark"] .agenda-todo { border-color: color-mix(in srgb, var(--todo-color) 38%, var(--surface)); }
[data-calendar-theme="dark"] .event-chip strong,
[data-calendar-theme="dark"] .agenda-event-time,
[data-calendar-theme="dark"] .dialog-date {
  color: color-mix(in srgb, var(--course-color) 74%, white);
}
[data-calendar-theme="dark"] .dialog-hero h2 { color: var(--ink); }
[data-calendar-theme="dark"] .filter-chip:hover,
[data-calendar-theme="dark"] .filter-chip[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--course-color) 48%, var(--line));
}
[data-calendar-theme="dark"] .holiday-swatch { border-color: #52475d; }
[data-calendar-theme="dark"] .today-swatch { border-color: #505669; }
.embed-mode .topbar { display: none; }
.embed-mode .workspace { min-height: 100vh; }

@media (max-width: 1180px) {
  .brand-title,
  .brand-scope,
  .brand-unit-primary .brand-english,
  .brand-unit-scope .brand-english { font-size: 17px; }
  .brand-copy { gap: 10px; }
  .brand-unit { gap: 7px; }
  .brand-divider { height: 19px; }
  .weekend-toggle { width: 34px; justify-content: center; padding: 0; }
  .weekend-toggle .toolbar-label { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
}

@media (max-width: 920px) {
  .toolbar-button { width: 34px; justify-content: center; padding: 0; }
  .toolbar-label { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .workspace { grid-template-columns: 220px minmax(0, 1fr); }
  .sidebar-section { padding: 18px 15px; }
  .main-panel { padding: 23px 20px 27px; }
  .calendar-description { display: none; }
}

@media (max-width: 820px) {
  .brand-english { display: none; }
  .brand-copy { gap: 9px; }
  .brand-divider { height: 18px; }
}

@media (max-width: 720px) {
  .topbar { height: 56px; padding: 0 13px; }
  .brand-title,
  .brand-scope { font-size: 14px; letter-spacing: 0.025em; }
  .brand-copy { gap: 6px; }
  .brand-unit { gap: 0; }
  .brand-divider { height: 15px; }
  .topbar-actions { gap: 5px; }
  .toolbar-button { width: 30px; height: 30px; justify-content: center; padding: 0; }
  .weekend-toggle { display: none; }
  .toolbar-label { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .workspace { display: block; min-height: calc(100vh - 56px); }
  .sidebar { border-right: 0; background: var(--surface); }
  .sidebar-section { padding: 17px 16px; }
  .tomorrow-card, .course-filter-section { border-bottom: 1px solid var(--line); }
  .filter-group { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; padding-bottom: 2px; }
  .filter-chip { display: inline-grid; grid-template-columns: 21px auto; width: auto; min-width: max-content; min-height: 33px; padding: 4px 7px; }
  .filter-symbol { width: 21px; height: 21px; }
  .main-panel { padding: 12px 12px 24px; }
  h1 { font-size: 20px; }
  .desktop-calendar { display: none; }
  .mobile-agenda { display: grid; gap: 8px; }
  .agenda-week { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
  .agenda-week.is-current { border-color: color-mix(in srgb, var(--current-week) 72%, transparent); box-shadow: inset 3px 0 color-mix(in srgb, var(--current-week) 72%, transparent); }
  .agenda-week-heading { display: flex; align-items: center; justify-content: space-between; padding: 10px 11px; border-bottom: 1px solid var(--line); background: var(--surface-soft); }
  .agenda-week-heading strong { font-size: 13px; font-weight: 650; }
  .agenda-week-heading span { color: var(--ink-soft); font-size: 9px; }
  .agenda-days { display: grid; }
  .agenda-day { display: grid; grid-template-columns: 45px 1fr; gap: 8px; padding: 10px 11px; }
  .agenda-day + .agenda-day { border-top: 1px solid var(--line); }
  .agenda-date strong, .agenda-date span { display: block; }
  .agenda-date strong { font-size: 11px; font-weight: 650; }
  .agenda-date span { margin-top: 2px; color: var(--ink-faint); font-size: 9px; }
  .agenda-day-events { display: grid; gap: 5px; }
  .agenda-event { display: grid; grid-template-columns: 43px 1fr; gap: 7px; align-items: start; padding: 7px 8px; border: 1px solid color-mix(in srgb, var(--course-color) 26%, white); border-left: 2px solid var(--course-color); border-radius: 6px; color: var(--ink); background: var(--course-soft); cursor: pointer; text-align: left; }
  .agenda-todo { display: grid; grid-template-columns: 43px 1fr; gap: 7px; align-items: start; padding: 7px 8px; border: 1px solid color-mix(in srgb, var(--todo-color) 32%, var(--line)); border-left: 2px solid var(--todo-color); border-radius: 6px; color: var(--ink); background: color-mix(in srgb, var(--todo-color) 11%, var(--surface)); cursor: pointer; text-align: left; }
  .agenda-event-time { color: var(--course-ink); font-size: 8px; font-weight: 720; white-space: nowrap; }
  .agenda-event strong, .agenda-todo strong { display: block; font-size: 10px; font-weight: 650; }
  .agenda-event span:last-child, .agenda-todo span:last-child { display: block; margin-top: 2px; color: var(--ink-soft); font-size: 8px; }
  .agenda-todo.is-done { opacity: 0.6; }
  .agenda-todo.is-done strong { text-decoration: line-through; }
  .agenda-empty { padding: 11px; color: var(--ink-faint); font-size: 10px; }
  .agenda-event.is-hidden, .agenda-day.is-empty-after-filter { display: none; }
  .calendar-legend { gap: 11px; margin: 12px 3px 0; }
  .timezone-note { width: 100%; margin: 0; }
  .dialog-details { grid-template-columns: 1fr; gap: 13px; }
}

@media (max-width: 400px) {
  .brand-title,
  .brand-scope { font-size: 12px; }
  .topbar-actions { gap: 4px; }
  .toolbar-button { width: 29px; height: 29px; }
}

@media (max-width: 360px) {
  .topbar { padding: 0 8px; }
  .brand-title,
  .brand-scope { font-size: 10px; }
  .brand-copy { gap: 4px; }
  .brand-divider { height: 13px; }
  .topbar-actions { gap: 3px; }
  .toolbar-button { width: 27px; height: 27px; }
}

@media print {
  @page { size: A3 landscape; margin: 9mm; }
  :root {
    color-scheme: light;
    --page: #ffffff;
    --surface: #ffffff;
    --surface-soft: #ffffff;
    --ink: #202124;
    --ink-soft: #6b7280;
    --ink-faint: #9ca3af;
    --line: #e5e7eb;
    --line-strong: #d1d5db;
    --week-label: #ffffff;
    --weekend: #ffffff;
    --event-ink: #3f4642;
    --event-meta: #626b66;
  }
  body, .app-frame { background: #fff; }
  .topbar, .sidebar, .mobile-agenda, .calendar-legend { display: none !important; }
  .workspace { display: block; min-height: 0; }
  .main-panel { padding: 0; }
  .calendar-heading { min-height: 0; margin-bottom: 4mm; }
  .desktop-calendar { display: block; overflow: visible; }
  .semester-board { min-width: 0; }
  html[data-weekends="collapsed"] .board-row { grid-template-columns: 66px repeat(7, minmax(0, 1fr)); }
  html[data-weekends="collapsed"] .board-header > .weekend-column { display: flex; }
  html[data-weekends="collapsed"] .week-row > .day-cell.weekend { display: block; }
  .board-row { grid-template-columns: 13mm repeat(7, 1fr); }
  .board-header > div { height: 6mm; }
  .week-row, .week-label, .day-cell { height: 9mm; min-height: 9mm; }
  .week-row.has-todo, .week-row.has-todo .week-label, .week-row.has-todo .day-cell { height: 11mm; min-height: 11mm; }
  .day-cell { padding: .8mm; }
  .event-chip { padding: .8mm .8mm .8mm 1.7mm; }
  .event-chip strong { font-size: 6pt; }
  .event-chip span, .holiday-label { display: none; }
  .todo-chip { height: 3mm; border-radius: 1mm; }
  .todo-time { display: none; }
  .todo-chip strong { font-size: 6pt; }
}

/* ===== 个人工作区新增：隐藏全部课程 / 规划事项 ===== */
.side-actions { display: inline-flex; align-items: center; gap: 9px; }
.todo-chip.is-hidden { display: none; }
.plan-empty { margin: 0; padding: 4px 2px; color: var(--ink-faint); font-size: 10px; }
.dialog-action { display: block; width: calc(100% - 48px); margin: 0 24px 22px; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--ink); background: var(--surface); cursor: pointer; font-size: 12px; font-weight: 620; }
.dialog-action:hover { background: color-mix(in srgb, var(--todo-color) 14%, var(--surface)); }

/* ===== 阶段2：子任务 / 项目卡片 ===== */
.todo-child-count { display: inline-grid; place-items: center; min-width: 15px; height: 13px; padding: 0 4px; margin-left: 3px; border-radius: 7px; background: var(--todo-color); color: #fff; font-size: 8px; font-weight: 700; vertical-align: middle; }
.project-list { display: grid; gap: 8px; margin-top: 13px; }
.project-card { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.project-header { display: grid; grid-template-columns: 24px 1fr auto auto; width: 100%; align-items: center; gap: 8px; padding: 8px; border: 0; background: transparent; cursor: pointer; text-align: left; }
.project-symbol { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 6px; color: #fff; background: var(--course-color); font-size: 10px; font-weight: 750; }
.project-title { font-size: 11px; font-weight: 650; color: var(--text-strong); }
.project-role { color: var(--ink-soft); font-size: 10px; }
.project-arrow { color: var(--ink-faint); font-size: 10px; transition: transform 150ms; }
.project-body { padding: 4px 8px 10px; border-top: 1px solid var(--line); }
.project-note { margin: 6px 0 8px; color: var(--ink-soft); font-size: 10px; line-height: 1.5; }
.child-task { display: flex; align-items: center; gap: 7px; padding: 4px 2px; font-size: 11px; color: var(--text-strong); cursor: pointer; }
.child-task input[type=checkbox] { width: 14px; height: 14px; accent-color: #4a90d9; flex-shrink: 0; }
.child-task span.is-done { text-decoration: line-through; opacity: 0.5; }
.dialog-children { padding: 0 24px 18px; }
.dialog-children-title { font-size: 10px; font-weight: 700; color: var(--ink-faint); letter-spacing: 0.06em; margin-bottom: 8px; }

/* ===== 阶段3：积分进度条 ===== */
.score-card { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-top: 13px; background: var(--surface); }
.score-row { margin-bottom: 10px; }
.score-row:last-of-type { margin-bottom: 0; }
.score-label { display: flex; justify-content: space-between; align-items: center; font-size: 10px; margin-bottom: 5px; }
.score-label span:first-child { font-weight: 650; color: var(--text-strong); }
.score-label span:last-child { color: var(--ink-soft); }
.score-bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.score-bar-fill { height: 100%; border-radius: 4px; transition: width 300ms ease; }
.score-note { font-size: 9px; color: var(--ink-faint); margin-top: 8px; line-height: 1.5; }

/* ===== 阶段4：今天/明天 tabs + 长期任务 ===== */
.card-tabs { display: inline-flex; gap: 4px; margin-bottom: 4px; }
.card-tab { padding: 2px 10px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--ink-soft); font-size: 10px; font-weight: 600; cursor: pointer; }
.card-tab.active { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.long-term-section { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.long-term-title { font-size: 10px; font-weight: 700; color: var(--ink-faint); letter-spacing: 0.06em; margin-bottom: 8px; }
.long-term-task { position: relative; }
.long-term-task.is-complete { opacity: .62; }
.completed-group-label { margin-top: 7px; padding-top: 8px; border-top: 1px dashed var(--line); color: var(--ink-faint); font-size: 9px; font-weight: 650; }
.long-term-proj { margin-left: auto; font-size: 9px; color: var(--ink-faint); flex-shrink: 0; }
.long-term-empty { margin: 0; font-size: 10px; color: var(--ink-faint); }

.floating-add-button { position: fixed; z-index: 35; right: 22px; bottom: 22px; display: inline-flex; height: 38px; align-items: center; gap: 7px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 9px; color: var(--surface); background: var(--ink); box-shadow: 0 8px 26px color-mix(in srgb, var(--ink) 18%, transparent); cursor: pointer; font-size: 11px; font-weight: 650; }
.floating-add-button svg { width: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.floating-add-button:hover { transform: translateY(-1px); }

/* ===== 本地添加窗口：延续原课表的克制排版，不引入新的视觉体系 ===== */
.planner-editor { width: min(620px, calc(100% - 24px)); max-height: calc(100vh - 24px); padding: 0; border: 1px solid var(--line-strong); border-radius: 12px; color: var(--ink); background: var(--surface); box-shadow: 0 20px 70px var(--dialog-shadow); }
.planner-editor::backdrop { background: var(--dialog-backdrop); }
.planner-form { padding: 22px 24px 20px; }
.planner-form-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.planner-form-header h2 { margin: 2px 0 0; font-size: 20px; font-weight: 650; }
.planner-form-kicker { margin: 0; color: var(--ink-faint); font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.planner-close { position: static; flex: 0 0 auto; }
.planner-mode-switch { display: inline-flex; gap: 4px; padding: 3px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); }
.planner-mode { padding: 6px 12px; border: 0; border-radius: 6px; color: var(--ink-soft); background: transparent; cursor: pointer; font-size: 11px; font-weight: 620; }
.planner-mode.active { color: var(--surface); background: var(--ink); }
.planner-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 14px; }
.planner-panel[hidden] { display: none; }
.planner-field { display: grid; gap: 6px; color: var(--ink-soft); font-size: 10px; font-weight: 620; }
.planner-field-wide { grid-column: 1 / -1; }
.planner-field input, .planner-field select, .planner-field textarea { width: 100%; min-width: 0; padding: 9px 10px; border: 1px solid var(--line-strong); border-radius: 7px; outline: none; color: var(--ink); background: var(--surface); font: inherit; font-size: 12px; font-weight: 450; resize: vertical; }
.planner-field input:focus, .planner-field select:focus, .planner-field textarea:focus { border-color: var(--current-week); box-shadow: 0 0 0 3px color-mix(in srgb, var(--current-week) 18%, transparent); }
.score-input { display: none; }
.score-input.is-visible { display: grid; }
.planner-form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.planner-cancel, .planner-submit { padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: 7px; cursor: pointer; font-size: 11px; font-weight: 650; }
.planner-cancel { color: var(--ink); background: var(--surface); }
.planner-submit { border-color: var(--ink); color: var(--surface); background: var(--ink); }
.detail-link { color: var(--course-ink, var(--ink)); text-underline-offset: 2px; }

@media (max-width: 560px) {
  .planner-form { padding: 19px 17px 16px; }
  .planner-panel { grid-template-columns: 1fr; }
  .planner-field-wide { grid-column: auto; }
}

/* ===== 阶段B：编辑删除 / 数据备份 / 文件库入口 ===== */
.dialog-actions { padding: 0 24px 22px; display: grid; gap: 8px; }
.dialog-actions .dialog-action { width: 100%; margin: 0; }
.dialog-link { display: flex; align-items: center; justify-content: center; text-decoration: none; }
.dialog-danger { border-color: #c0392b !important; color: #c0392b !important; }
.dialog-danger:hover { background: rgba(192, 57, 43, 0.08) !important; }
.files-link { text-decoration: none; }
.project-actions { display: flex; gap: 6px; margin-top: 8px; }
.project-act { border: 1px solid var(--line); background: transparent; border-radius: 6px; padding: 3px 10px; font-size: 10px; color: var(--ink-soft); cursor: pointer; }
.project-act:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.project-act-danger { color: #c0392b; border-color: rgba(192, 57, 43, 0.4); }
.data-actions { display: flex; gap: 8px; margin-top: 13px; }
.data-actions .text-button { padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; }
.data-hint { margin: 8px 0 0; font-size: 10px; color: var(--ink-faint); line-height: 1.5; }

/* ===== 打卡进度：可点击行 / +1 按钮 / 圆环弹窗 ===== */
.score-row-click { display: block; width: 100%; padding: 0; border: 0; background: transparent; cursor: pointer; text-align: left; font: inherit; }
.score-row-click:hover .score-label span:first-child { text-decoration: underline; text-underline-offset: 3px; }
.checkin-line { display: flex; align-items: center; gap: 7px; }
.checkin-bar { flex: 1 1 auto; }
.checkin-btn { flex: 0 0 auto; height: 22px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 6px; color: var(--ink); background: var(--surface); cursor: pointer; font-size: 10px; font-weight: 700; }
.checkin-btn:hover:not(:disabled) { background: color-mix(in srgb, #4E79A7 14%, var(--surface)); border-color: #4E79A7; }
.checkin-btn:disabled { opacity: 0.35; cursor: default; }
.checkin-count { font-variant-numeric: tabular-nums; }

.score-detail-dialog { width: min(430px, calc(100% - 30px)); }
.score-detail-hero { display: flex; align-items: center; gap: 18px; padding: 22px 22px 16px; }
.score-ring-wrap { position: relative; flex: 0 0 auto; width: 128px; height: 128px; }
.score-ring { width: 128px; height: 128px; transform: rotate(-90deg); }
.score-ring-track { fill: none; stroke: var(--line); stroke-width: 9; }
.score-ring-fill { fill: none; stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset 500ms ease; }
.score-ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.score-ring-center strong { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.score-ring-center span { color: var(--ink-soft); font-size: 10px; font-weight: 600; }
.score-detail-summary h2 { margin: 0 0 6px; font-size: 16px; font-weight: 680; }
.score-detail-summary p { margin: 0; color: var(--ink-soft); font-size: 11px; line-height: 1.6; }
.score-detail-summary strong { color: var(--ink); font-size: 13px; }
.score-detail-list { padding: 4px 22px 22px; }
.score-detail-list-title { margin-bottom: 9px; color: var(--ink-faint); font-size: 10px; font-weight: 700; letter-spacing: 0.06em; }
.score-detail-row { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto auto; align-items: center; gap: 9px; padding: 8px 0; border-top: 1px solid var(--line); }
.score-detail-dot { width: 8px; height: 8px; border-radius: 50%; }
.score-detail-info strong { display: block; font-size: 12px; font-weight: 650; }
.score-detail-info span { display: block; margin-top: 2px; color: var(--ink-soft); font-size: 9px; }
.score-detail-value { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.score-detail-status { padding: 2px 6px; border-radius: 6px; background: color-mix(in srgb, #E15759 12%, var(--surface)); color: #E15759; font-size: 9px; font-weight: 650; }
.score-detail-status.is-paid { background: color-mix(in srgb, #59A14F 14%, var(--surface)); color: #59A14F; }
.score-detail-empty { margin: 0; color: var(--ink-faint); font-size: 11px; }

/* ===== 每日待办 ===== */
.daily-date { color: var(--ink-soft); font-size: 10px; font-weight: 600; }
.daily-todo-card { margin-top: 13px; }
.daily-group + .daily-group { margin-top: 12px; }
.daily-group-label { margin-bottom: 6px; color: var(--ink-faint); font-size: 10px; font-weight: 700; letter-spacing: 0.05em; }
.daily-todo-item { position: relative; }
.daily-remove { margin-left: auto; flex: 0 0 auto; width: 20px; height: 20px; border: 0; border-radius: 5px; color: var(--ink-faint); background: transparent; cursor: pointer; font-size: 13px; line-height: 1; }
.daily-remove:hover { color: #c0392b; background: color-mix(in srgb, #c0392b 10%, transparent); }
.daily-overdue { margin-left: auto; flex-shrink: 0; color: #c0392b; font-size: 9px; font-weight: 600; }
.daily-todo-item .daily-remove + .daily-overdue, .daily-todo-item .long-term-proj + .daily-remove { margin-left: 0; }
.daily-add-line { margin-top: 11px; }
.daily-add-line input { width: 100%; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 7px; outline: none; color: var(--ink); background: var(--surface); font: inherit; font-size: 12px; }
.daily-add-line input:focus { border-color: var(--current-week); box-shadow: 0 0 0 3px color-mix(in srgb, var(--current-week) 18%, transparent); }
.daily-sync-group { padding-top: 10px; border-top: 1px dashed var(--line); }
.daily-sync-chip { display: inline-flex; max-width: 100%; align-items: center; gap: 4px; margin: 0 5px 5px 0; padding: 4px 9px; border: 1px solid var(--line); border-radius: 14px; color: var(--text-strong); background: var(--surface); cursor: pointer; font-size: 10px; text-align: left; }
.daily-sync-chip:hover { border-color: var(--current-week); background: var(--current-week-soft); }
.daily-sync-chip span { color: var(--current-week-ink); font-weight: 700; }
.daily-sync-chip > span:not(.daily-sync-label) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== 移动端视图切换条 / 已过去周折叠 ===== */
.agenda-view-bar { display: none; }
@media (max-width: 720px) {
  .agenda-view-bar { display: inline-flex; gap: 4px; padding: 3px; margin-bottom: 2px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); }
  .agenda-view-tab { padding: 6px 13px; border: 0; border-radius: 6px; color: var(--ink-soft); background: transparent; cursor: pointer; font-size: 11px; font-weight: 620; }
  .agenda-view-tab.active { color: var(--surface); background: var(--ink); }
  .agenda-past { overflow: hidden; border: 1px dashed var(--line-strong); border-radius: 8px; background: color-mix(in srgb, var(--line) 22%, var(--surface)); }
  .agenda-past-toggle { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 11px; border: 0; background: transparent; cursor: pointer; text-align: left; font: inherit; }
  .agenda-past-toggle strong { font-size: 12px; font-weight: 650; color: var(--ink-soft); }
  .agenda-past-toggle span { color: var(--ink-faint); font-size: 10px; flex-shrink: 0; }
  .agenda-past-body { display: grid; gap: 8px; padding: 0 8px 8px; }
  .agenda-past-body .agenda-week { box-shadow: 0 0 0 1px var(--line) inset; }
}

/* ===== 修复：手机端标题栏图标与标题重叠 =====
   原因：topbar 是 1fr auto 1fr 网格，品牌区 white-space:nowrap 且不可收缩，
   窄屏时中间 auto 列撑开把两侧列挤到 0，右侧按钮区被推出屏幕/视觉上压到标题。
   改法：窄屏下 topbar 改为 flex，品牌区允许收缩省略，按钮区固定不被压缩。 */
@media (max-width: 720px) {
  .topbar { display: flex; gap: 10px; }
  .brand-block { flex: 1 1 auto; order: 1; min-width: 0; justify-self: auto; }
  .brand-copy { min-width: 0; }
  .brand-unit { min-width: 0; }
  .brand-scope { overflow: hidden; max-width: 100%; text-overflow: ellipsis; white-space: nowrap; }
  .brand-title { flex-shrink: 0; }
  .topbar-actions { order: 2; flex: 0 0 auto; justify-self: auto; }
}
