:root {
  color-scheme: light;
  --paper: #fff;
  --side: #f5f6f2;
  --background: #fbfcfa;
  --ink: #202923;
  --muted: #59635d;
  --subtle: #6a756e;
  --line: #e4e9e2;
  --accent: #285444;
  --accent-dark: #1b4134;
  --tint: #e8f0e9;
  --shadow: 0 16px 42px #233d2d12;
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--background); }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid #397b63; outline-offset: 3px;
}
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.icon { display: block; width: 19px; height: 19px; flex: 0 0 auto; }
[data-icon] { display: inline-flex; align-items: center; justify-content: center; }
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); height: 100vh; height: 100dvh; }
.sidebar { background: var(--side); border-right: 1px solid var(--line); padding: 24px 14px 13px; display: flex; flex-direction: column; min-height: 0; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 9px; font-weight: 760; font-size: 19px; letter-spacing: .03em; line-height: 1.25; }
.brand small, .side-profile small { display: block; color: var(--subtle); font-size: 11px; font-weight: 500; letter-spacing: 0; margin-top: 4px; }
.brand-symbol { background: var(--accent); color: white; border-radius: 12px; width: 41px; height: 41px; }
.brand-symbol .icon { width: 24px; height: 24px; }
.new-chat { display: flex; align-items: center; gap: 9px; padding: 11px 10px; background: var(--paper); border: 1px solid #dce4dc; color: var(--accent-dark); border-radius: 10px; text-align: left; font-size: 13px; font-weight: 680; margin: 29px 2px 22px; }
.new-chat:hover, .secondary:hover { background: var(--tint); }
.new-chat-end { margin-left: auto; color: #638073; }
.new-chat-end .icon { width: 15px; }
.side-label { margin: 0 10px 8px; color: var(--subtle); font-size: 11px; font-weight: 650; letter-spacing: .1em; }
nav { display: grid; gap: 3px; }
nav a { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; border-radius: 8px; color: #404b44; font-size: 13px; }
nav a:hover, .history-item:hover, .side-profile:hover { background: #ebeee8; }
nav a[aria-current="page"] { color: var(--accent-dark); background: #e4ece3; font-weight: 700; }
nav .icon { width: 17px; height: 17px; }
.history-label { margin-top: 27px; }
.history { overflow: auto; flex: 1; scrollbar-width: thin; }
.history-empty { padding: 3px 10px; color: var(--subtle); font-size: 12px; }
.history-item { display: flex; align-items: center; border-radius: 8px; min-width: 0; }
.history-item.active { background: #e9eee7; }
.history-link { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; border: 0; background: transparent; padding: 9px 8px 9px 10px; color: #404b44; font-size: 12px; }
.history-item .icon-button { width: 29px; height: 30px; margin-right: 3px; }
.history-item .icon { width: 14px; height: 14px; }
.side-profile { display: flex; align-items: center; gap: 9px; border-radius: 9px; padding: 8px; margin-top: 10px; }
.side-profile b { display: block; max-width: 137px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.side-profile small { max-width: 137px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 33px; height: 33px; border-radius: 50%; background: #e4ece0; color: var(--accent-dark); font-weight: 700; }
.profile-chevron { margin-left: auto; color: var(--subtle); }
.profile-chevron .icon { width: 15px; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; gap: 12px; min-height: 63px; padding: 0 27px; border-bottom: 1px solid var(--line); }
.page-title { font-size: 14px; font-weight: 700; }
.status { display: inline-flex; align-items: center; gap: 7px; margin-left: auto; padding: 5px 10px; border: 1px solid var(--line); border-radius: 20px; color: var(--muted); font-size: 11px; white-space: nowrap; max-width: 48%; overflow: hidden; text-overflow: ellipsis; }
.status::before { content: ""; flex: 0 0 6px; height: 6px; border-radius: 50%; background: #a29368; }
.status.live::before { background: #398469; }
.mobile-toggle { display: none; }
.chat-page { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.chat-scroll { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; scrollbar-width: thin; }
.welcome { width: min(100% - 48px, 760px); margin: auto; text-align: center; padding: 37px 0; }
.welcome-mark { width: 64px; height: 64px; color: var(--accent); background: var(--tint); border: 1px solid #dce9dc; border-radius: 20px; margin-bottom: 13px; }
.welcome-mark .icon { width: 34px; height: 34px; }
.welcome h1 { font-size: clamp(27px, 4vw, 40px); line-height: 1.2; margin: 9px 0 13px; letter-spacing: -.055em; }
.welcome p { color: var(--muted); font-size: 14px; margin: 0; line-height: 1.7; }
.suggestions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; margin: 33px auto 0; text-align: left; }
.suggestions button { position: relative; min-width: 0; text-align: left; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 13px; padding: 13px 14px; display: grid; gap: 9px; }
.suggestions button:hover { border-color: #a7bcae; background: #f5faf6; }
.suggestions b, .suggestions small { display: block; }
.suggestions b { font-size: 13px; margin-bottom: 4px; }
.suggestions small { color: var(--muted); font-size: 11px; line-height: 1.55; }
.suggest-icon { width: 30px; height: 30px; border-radius: 8px; background: var(--tint); color: var(--accent); }
.suggest-icon .icon { width: 15px; height: 15px; }
.suggest-arrow { position: absolute; right: 12px; top: 13px; color: var(--subtle); }
.suggest-arrow .icon { width: 14px; height: 14px; }
.composer-wrap { width: min(100% - 48px, 760px); margin: 10px auto 0; }
.composer { border: 1px solid #dae2db; border-radius: 19px; background: var(--paper); padding: 12px 12px 9px; box-shadow: 0 6px 25px #304c3010; }
.composer:focus-within { border-color: #9eb4a7; }
.composer textarea { display: block; width: 100%; resize: vertical; min-height: 43px; max-height: 160px; border: 0; color: var(--ink); padding: 3px 5px; background: transparent; outline: 0; font-size: 14px; line-height: 1.55; }
.composer textarea:focus-visible { outline: 0; }
.composer textarea::placeholder { color: #727e77; }
.composer-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.context-toggle { position: relative; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; color: var(--muted); padding: 5px 8px; font-size: 11px; border-radius: 20px; border: 1px solid var(--line); }
.context-toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.context-toggle:focus-within { outline: 2px solid #397b63; outline-offset: 2px; }
.context-toggle:has(:checked) { background: #eef5ef; border-color: #dbe9de; color: var(--accent-dark); }
.toggle-dot { width: 6px; height: 6px; border-radius: 50%; background: #8a928e; }
.context-toggle:has(:checked) .toggle-dot { background: #398469; }
.context-toggle .icon { width: 13px; height: 13px; }
.send { border: 0; border-radius: 50%; height: 35px; width: 35px; color: #fff; background: var(--accent); }
.send:disabled { background: #dce5dd; color: #58655e; }
.composer-hint { text-align: center; font-size: 11px; color: var(--subtle); margin: 11px 0 13px; line-height: 1.5; }
.messages { width: min(100% - 48px, 760px); margin: 0 auto; padding: 24px 0 10px; display: grid; gap: 21px; }
.message { min-width: 0; }
.message.user { justify-self: end; max-width: 86%; border-radius: 17px 17px 4px 17px; background: #e8f0e8; padding: 10px 15px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.65; font-size: 14px; }
.message.assistant { display: grid; grid-template-columns: 31px minmax(0,1fr); gap: 11px; }
.message-symbol { align-self: start; width: 31px; height: 31px; background: var(--tint); color: var(--accent); border-radius: 9px; }
.message-symbol .icon { width: 18px; height: 18px; }
.message-head { display: flex; align-items: center; gap: 8px; margin: 5px 0 8px; font-size: 13px; font-weight: 700; }
.reply { line-height: 1.75; font-size: 14px; overflow-wrap: anywhere; }
.reply p { margin: 0 0 10px; white-space: pre-wrap; }
.reply ul, .reply ol { margin: 0 0 11px; padding-left: 22px; }
.reply pre { overflow: auto; background: #f0f3ee; border-radius: 9px; padding: 12px; }
.reply code { font-family: "IBM Plex Mono", monospace; background: #eef1eb; padding: 2px 4px; border-radius: 3px; }
.reply pre code { background: transparent; padding: 0; }
.reply h3 { font-size: 15px; margin: 10px 0 6px; }
.message-meta { color: var(--subtle); font-size: 11px; margin-top: 9px; }
.message-error { color: #9a3f34; font-size: 13px; }
.tag { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 20px; font-size: 10px; font-weight: 660; background: #edf2eb; color: #3d624f; }
.tag.high { background: #f8eae1; color: #8e4e32; }
.tag.low { background: #eceef2; color: #505b69; }
.proposal { border: 1px solid #dbe7dc; border-radius: 12px; padding: 13px; margin-top: 13px; background: #f5f9f4; }
.proposal strong { display: block; margin: 7px 0; font-size: 14px; }
.proposal p { margin: 0 0 10px; color: var(--muted); font-size: 12px; }
.module { flex: 1; overflow: auto; padding: 34px clamp(20px, 5vw, 62px) 40px; }
.module-inner { max-width: 1080px; margin: 0 auto; }
.module-head { display: flex; align-items: start; justify-content: space-between; gap: 14px; margin-bottom: 24px; }
.module-head h1 { font-size: 31px; margin: 0 0 7px; letter-spacing: -.04em; }
.module-head p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.primary, .secondary { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 9px; padding: 9px 13px; color: white; background: var(--accent); font-size: 13px; font-weight: 650; white-space: nowrap; }
.primary:hover { background: var(--accent-dark); }
.primary:disabled { opacity: .65; }
.secondary { border-color: var(--line); background: var(--paper); color: var(--ink); }
.primary .icon, .secondary .icon { width: 15px; height: 15px; }
.icon-button { border: 0; padding: 0; width: 32px; height: 32px; border-radius: 8px; display: inline-flex; justify-content: center; align-items: center; color: var(--muted); background: transparent; }
.icon-button:hover { background: #e8eee8; color: var(--accent-dark); }
.icon-button .icon { width: 17px; height: 17px; }
.week-controls { display: flex; align-items: center; gap: 8px; margin: 0 0 15px; flex-wrap: wrap; }
.week-controls strong { min-width: 151px; text-align: center; font-size: 13px; }
.week-controls .secondary { margin-left: 3px; padding: 5px 10px; font-size: 11px; }
.schedule-grid { display: grid; grid-template-columns: repeat(7, minmax(105px, 1fr)); gap: 7px; overflow-x: auto; padding: 1px 1px 8px; }
.day-column { min-height: 265px; background: #f4f6f2; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.day-column.today { border-color: #a2b8a6; background: #f0f5ef; }
.day-head { display: flex; align-items: center; justify-content: space-between; gap: 3px; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.day-head strong { font-size: 12px; }
.day-head small { color: var(--subtle); font-size: 10px; }
.day-empty { color: var(--subtle); font-size: 11px; text-align: center; margin: 15px 5px; }
.course { margin: 7px 5px; padding: 8px 7px; background: var(--paper); border: 1px solid #e0e8df; border-left: 3px solid #789b84; border-radius: 8px; overflow-wrap: anywhere; }
.course b, .course span { display: block; }
.course b { font-size: 12px; line-height: 1.4; }
.course span { font-size: 10px; color: var(--muted); line-height: 1.5; margin-top: 3px; }
.course-actions { display: flex; justify-content: end; }
.course .icon-button { width: 24px; height: 24px; }
.course .icon-button .icon { width: 13px; height: 13px; }
.empty { padding: 28px 18px; color: var(--muted); border: 1px dashed #d5dfd6; border-radius: 12px; background: var(--paper); text-align: center; font-size: 13px; line-height: 1.7; }
.empty button { margin-top: 8px; }
.filters { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 13px; }
.filters button[aria-pressed="true"] { background: var(--tint); border-color: #cadbce; color: var(--accent-dark); }
.task-list { display: grid; gap: 8px; }
.task { display: flex; align-items: start; gap: 10px; background: var(--paper); border: 1px solid var(--line); border-radius: 11px; padding: 12px; }
.task input { accent-color: var(--accent); width: 17px; height: 17px; margin: 4px 1px 0; flex: 0 0 auto; }
.task-main { flex: 1; min-width: 0; }
.task-main strong { display: block; font-size: 14px; overflow-wrap: anywhere; }
.task.done strong { text-decoration: line-through; color: var(--muted); }
.task p { color: var(--muted); margin: 4px 0 0; font-size: 12px; overflow-wrap: anywhere; white-space: pre-wrap; }
.task-actions { display: flex; align-items: center; gap: 4px; }
.profile-form { background: var(--paper); border: 1px solid var(--line); padding: 19px; border-radius: 13px; max-width: 760px; }
.form-fields { display: grid; gap: 12px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.field { display: grid; gap: 5px; font-size: 12px; font-weight: 650; min-width: 0; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid #dce4dd; border-radius: 8px; background: #fcfdfb; padding: 8px 9px; color: var(--ink); font-size: 13px; font-weight: 400; }
.field textarea { resize: vertical; min-height: 64px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.profile-note { color: var(--muted); font-size: 12px; line-height: 1.6; margin-top: 12px; max-width: 760px; }
dialog { color: var(--ink); border: 1px solid var(--line); border-radius: 15px; background: var(--paper); box-shadow: var(--shadow); width: min(460px, 100% - 26px); padding: 0; max-height: 90dvh; }
dialog::backdrop { background: #202d26a0; }
.dialog-form { padding: 17px; }
.dialog-form header, .dialog-form footer { display: flex; justify-content: space-between; align-items: center; gap: 7px; }
.dialog-form header { margin-bottom: 13px; }
.dialog-form header h2 { margin: 0; font-size: 19px; }
.dialog-form footer { justify-content: end; margin-top: 14px; }
.form-error { font-size: 12px; color: #9a3f34; }
.form-warning { color: #805527; background: #f9f0df; padding: 8px 10px; border-radius: 7px; font-size: 12px; margin: 0; }
.toast { position: fixed; z-index: 5; right: 15px; bottom: 15px; max-width: min(430px, 100% - 30px); background: #263f34; color: #fff; border-radius: 9px; padding: 10px 13px; box-shadow: var(--shadow); font-size: 13px; }
.overlay { display: none; }
@media (max-width: 870px) {
  .shell { grid-template-columns: 202px minmax(0,1fr); }
  .topbar { padding: 0 18px; }
  .suggestions { gap: 7px; }
  .suggestions button { padding: 10px; }
  .task-actions .tag { display: none; }
}
@media (max-width: 640px) {
  .shell { display: block; }
  .main { height: 100%; }
  .sidebar { position: fixed; z-index: 3; top: 0; bottom: 0; left: 0; width: 245px; visibility: hidden; transform: translateX(-100%); transition: transform .18s ease, visibility .18s; }
  .sidebar.open { visibility: visible; transform: translateX(0); }
  .overlay:not([hidden]) { display: block; position: fixed; inset: 0; border: 0; z-index: 2; background: #19251d7d; }
  .mobile-toggle { display: inline-flex; }
  .topbar { min-height: 53px; padding: 0 12px; }
  .welcome, .messages, .composer-wrap { width: calc(100% - 26px); }
  .welcome { padding: 22px 0; }
  .welcome-mark { width: 52px; height: 52px; margin-bottom: 5px; }
  .welcome-mark .icon { width: 28px; height: 28px; }
  .welcome p { font-size: 12px; }
  .suggestions { grid-template-columns: 1fr; margin-top: 17px; }
  .suggestions button { display: flex; align-items: center; gap: 8px; padding: 7px 9px; }
  .suggestions b { font-size: 12px; margin-bottom: 0; }
  .suggest-arrow { top: 50%; transform: translateY(-50%); }
  .module { padding: 23px 13px; }
  .module-head { flex-wrap: wrap; }
  .module-head h1 { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
.composer-tools { justify-content: start; }
.composer-tools .send { margin-left: auto; }
.attachment { display: flex; align-items: center; gap: 8px; padding: 4px 5px; font-size: 12px; }
.attachment img { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); }
.attachment span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-image { display: block; max-width: min(290px, 100%); max-height: 230px; border-radius: 9px; object-fit: contain; margin: 2px 0 7px; }
.module-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.course-import { width: min(850px, 100% - 26px); }
.import-guide { color: var(--muted); margin: 8px 0 12px; font-size: 12px; line-height: 1.6; }
.import-guide:empty { display: none; }
.import-rows { display: grid; gap: 7px; margin-top: 11px; }
.import-row { display: grid; grid-template-columns: minmax(170px, 2fr) repeat(3, minmax(96px, 1fr)); gap: 7px; border: 1px solid var(--line); padding: 8px; border-radius: 8px; }
.import-name { display: flex; align-items: end; gap: 5px; }
.import-name .field { flex: 1; }
.import-name > input { accent-color: var(--accent); margin: 0 3px 11px 1px; }
.import-location { grid-column: 1 / 2; }
.import-memo { grid-column: 2 / -1; }
@media (max-width: 650px) {
  .import-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .import-location, .import-memo { grid-column: auto; }
}

.auth-view { min-height: 100dvh; display: grid; place-items: center; padding: 24px 14px; }
.auth-card { display: grid; gap: 14px; width: min(100%, 390px); padding: 25px; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 9px; color: var(--accent-dark); font-weight: 700; font-size: 14px; }
.auth-brand .brand-symbol { width: 33px; height: 33px; border-radius: 9px; }
.auth-brand .icon { width: 19px; height: 19px; }
.auth-card h1 { margin: 0 0 2px; font-size: 25px; }
.auth-modes { display: flex; gap: 7px; }
.auth-modes [aria-pressed="true"] { background: var(--tint); color: var(--accent-dark); border-color: #cadbce; }
.auth-code { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.auth-feedback { margin: 0; color: var(--accent-dark); font-size: 12px; line-height: 1.55; }
.auth-feedback.error { color: #9a3f34; }
.history-pin[aria-pressed="true"] { color: var(--accent); }
.history-pin[aria-pressed="true"] .icon { fill: var(--tint); }
@media (min-width: 641px) {
  .shell.sidebar-collapsed { grid-template-columns: 65px minmax(0, 1fr); }
  .sidebar-collapsed .sidebar { padding-inline: 9px; }
  .sidebar-collapsed .brand { padding: 0; justify-content: center; }
  .sidebar-collapsed .brand > span:not(.brand-symbol), .sidebar-collapsed .side-text,
  .sidebar-collapsed .new-chat-end, .sidebar-collapsed .side-label, .sidebar-collapsed .history,
  .sidebar-collapsed .profile-chevron { display: none; }
  .sidebar-collapsed nav a, .sidebar-collapsed .new-chat, .sidebar-collapsed .side-profile { justify-content: center; padding-inline: 0; }
  .sidebar-collapsed .side-profile { margin-top: auto; }
}
@media (max-width: 640px) {
  .desktop-toggle { display: none; }
}
