:root {
  color-scheme: light;
  --nav: #111a2b;
  --nav-soft: #19243a;
  --blue: #1f63d8;
  --blue-dark: #164fae;
  --blue-soft: #eef5ff;
  --mint: #087a5e;
  --mint-soft: #eafaf5;
  --purple: #6745cf;
  --purple-soft: #f2efff;
  --amber: #925700;
  --amber-soft: #fff7e8;
  --pink: #b52c59;
  --pink-soft: #fff0f4;
  --cyan: #08748a;
  --cyan-soft: #eafaff;
  --red: #c62f47;
  --red-soft: #fff0f2;
  --ink: #172033;
  --muted: #5f6b80;
  --line: #e5eaf1;
  --surface: #fff;
  --canvas: #f3f6fa;
  --shadow: 0 6px 24px rgb(24 40 72 / 5%);
  --radius: 14px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-width: 320px; min-height: 100%; background: var(--canvas); color: var(--ink); }
body { min-height: 100vh; font-size: 14px; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, a, select, input[type="checkbox"], input[type="radio"] { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: 3px solid rgb(31 99 216 / 72%); outline-offset: 2px; }
[inert] { pointer-events: none; user-select: none; }
.icon { width: 20px; height: 20px; flex: 0 0 auto; }
.grow { min-width: 0; flex: 1; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.skip-link { position: fixed; z-index: 220; top: max(8px, env(safe-area-inset-top)); left: max(8px, env(safe-area-inset-left)); transform: translateY(-160%); border-radius: 9px; padding: 10px 14px; background: var(--nav); color: #fff; font-weight: 700; text-decoration: none; box-shadow: var(--shadow); }
.skip-link:focus { transform: translateY(0); }

.boot-screen, .fatal-screen { min-height: 100vh; display: grid; place-content: center; text-align: center; gap: 12px; color: var(--muted); }
.boot-mark { margin: auto; display: grid; place-items: center; width: 54px; height: 54px; border-radius: 15px; background: var(--blue); color: #fff; font-size: 26px; font-weight: 800; box-shadow: 0 12px 30px rgb(46 115 237 / 30%); animation: pulse 1.5s infinite; }
.fatal-screen .icon { width: 48px; height: 48px; margin: auto; color: var(--red); }
.fatal-screen h1, .fatal-screen p { margin: 0; }
.fatal-screen button { margin: 8px auto; border: 0; border-radius: 10px; padding: 10px 18px; background: var(--blue); color: #fff; cursor: pointer; }
@keyframes pulse { 50% { transform: translateY(-3px); box-shadow: 0 16px 36px rgb(46 115 237 / 36%); } }

.auth-open { background: #fff; }
.auth-screen { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(390px, 1.08fr) minmax(430px, .92fr); background: #fff; }
.auth-story { position: relative; overflow: hidden; padding: max(42px, env(safe-area-inset-top)) max(48px, env(safe-area-inset-right)) max(42px, env(safe-area-inset-bottom)) max(48px, env(safe-area-inset-left)); background: radial-gradient(circle at 78% 18%, rgb(62 126 255 / 28%), transparent 28%), radial-gradient(circle at 8% 82%, rgb(32 190 153 / 15%), transparent 30%), var(--nav); color: #fff; display: flex; flex-direction: column; }
.auth-story::after { content: ""; position: absolute; width: 430px; height: 430px; right: -180px; bottom: -200px; border: 1px solid rgb(255 255 255 / 10%); border-radius: 50%; box-shadow: 0 0 0 70px rgb(255 255 255 / 2%), 0 0 0 140px rgb(255 255 255 / 2%); pointer-events: none; }
.auth-brand { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.auth-brand > span, .auth-mobile-brand > span { width: 40px; height: 40px; border-radius: 12px; background: var(--blue); color: #fff; display: inline-grid; place-items: center; font-size: 18px; font-weight: 800; box-shadow: inset 0 1px rgb(255 255 255 / 24%); }
.auth-brand div { display: grid; gap: 3px; }
.auth-brand strong { font-size: 16px; }
.auth-brand small { color: #9eabc0; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.auth-story-copy { max-width: 620px; margin: auto 0; position: relative; z-index: 1; }
.auth-eyebrow { margin: 0 0 12px; color: #7da8ff; font-size: 12px; font-weight: 750; letter-spacing: .08em; }
.auth-story-copy h2 { max-width: 580px; margin: 0; font-size: clamp(34px, 4.8vw, 62px); line-height: 1.12; letter-spacing: -.045em; }
.auth-story-copy > p:last-child { max-width: 530px; margin: 24px 0 0; color: #afbbcd; font-size: 15px; line-height: 1.9; }
.auth-privacy { position: relative; z-index: 1; display: flex; align-items: center; gap: 11px; color: #dbe5f6; }
.auth-privacy > .icon { width: 20px; color: #58d3aa; }
.auth-privacy > span { display: grid; gap: 2px; }
.auth-privacy strong { font-size: 12px; }
.auth-privacy small { color: #8f9db4; font-size: 11px; }
.auth-panel { min-width: 0; padding: max(38px, env(safe-area-inset-top)) max(38px, env(safe-area-inset-right)) max(38px, env(safe-area-inset-bottom)) max(38px, env(safe-area-inset-left)); display: grid; place-items: center; background: linear-gradient(145deg, #fff, #f8faff); }
.auth-form-wrap { width: min(400px, 100%); }
.auth-form-wrap > .auth-eyebrow { color: var(--blue); }
.auth-form-wrap h1 { margin: 0; font-size: 29px; letter-spacing: -.025em; }
.auth-form-wrap h1:focus { outline: 0; }
.auth-form-wrap h1:focus-visible { outline: 2px solid rgb(31 99 216 / 55%); outline-offset: 4px; border-radius: 4px; }
.auth-help { margin: 10px 0 28px; color: var(--muted); line-height: 1.6; }
.auth-mobile-brand { display: none; }
.auth-form { display: grid; gap: 3px; }
.auth-field { margin-bottom: 14px !important; }
.auth-field input { min-height: 48px; }
.auth-submit { width: 100%; min-height: 48px !important; margin-top: 5px; }
.auth-error, .auth-message { min-height: 42px; margin: -10px 0 18px; border: 1px solid #ffd1d8; border-radius: 10px; padding: 10px 12px; background: var(--red-soft); color: var(--red); font-size: 12px; line-height: 1.6; }
.auth-error[hidden] { display: none; }
.auth-message { border-color: #bdebdc; background: var(--mint-soft); color: var(--mint); display: flex; align-items: center; gap: 8px; }
.auth-message .icon { width: 16px; }
.auth-footnote { margin: 22px 0 0; color: var(--muted); text-align: center; font-size: 11px; line-height: 1.6; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; width: 228px; padding-left: env(safe-area-inset-left); background: var(--nav); color: #d9e1f0; display: flex; flex-direction: column; overflow: auto; }
.brand { min-height: 76px; padding: calc(15px + env(safe-area-inset-top)) 16px 15px; display: flex; align-items: center; gap: 10px; }
.brand > span, .mobile-brand > span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(145deg, #347eff, #1c62d9); color: #fff; font-weight: 800; box-shadow: inset 0 1px rgb(255 255 255 / 25%); }
.brand div { min-width: 0; display: grid; gap: 2px; }
.brand strong { white-space: nowrap; font-size: 14px; color: #fff; }
.brand small { color: #98a7bf; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.sidebar-close { display: none !important; margin-left: auto; }
.class-switcher { margin: 0 12px 10px; border: 1px solid rgb(255 255 255 / 7%); border-radius: 12px; padding: 10px; color: inherit; background: var(--nav-soft); display: flex; align-items: center; gap: 9px; cursor: pointer; text-align: left; transition: .2s; }
.class-switcher:hover { background: #1e2c45; }
.class-switcher > span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--blue); color: #fff; font-weight: 800; }
.class-switcher div { min-width: 0; flex: 1; display: grid; gap: 3px; }
.class-switcher strong { color: #fff; font-size: 13px; }
.class-switcher small { color: #a6b2c5; font-size: 11px; }
.class-switcher .icon { width: 16px; color: #69758b; }
.sidebar nav { padding: 2px 10px 76px; }
.nav-group { margin: 8px 0 13px; }
.nav-group > h2 { display: block; margin: 0; padding: 0 9px 6px; color: #7f8ca4; font-size: 11px; font-weight: 600; }
.nav-item { width: 100%; height: 38px; border: 0; border-radius: 8px; padding: 0 10px; background: transparent; color: #aeb9cc; display: flex; align-items: center; gap: 10px; cursor: pointer; transition: .18s ease; text-align: left; }
.nav-item .icon { width: 17px; height: 17px; }
.nav-item b { flex: 1; font-size: 13px; font-weight: 550; }
.nav-item em { min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; display: grid; place-items: center; font-size: 10px; font-style: normal; background: #f23462; color: #fff; }
.nav-item:hover { color: #fff; background: rgb(255 255 255 / 5%); }
.nav-item.active { color: #fff; background: var(--blue); box-shadow: 0 6px 16px rgb(22 101 223 / 28%); }
.nav-item.active em { background: #fff; color: var(--blue); }
.sidebar-footer { position: fixed; z-index: 2; left: 0; bottom: 0; width: 228px; height: calc(58px + env(safe-area-inset-bottom)); display: flex; align-items: center; padding: 0 16px env(safe-area-inset-bottom) max(16px, env(safe-area-inset-left)); gap: 10px; background: linear-gradient(180deg, rgb(17 26 43 / 10%), #111a2b 28%); }
.sidebar-footer button { border: 0; background: none; color: #9aa8bd; display: flex; gap: 8px; align-items: center; cursor: pointer; font-size: 12px; }
.sidebar-footer .icon { width: 16px; }
.privacy-status { margin-left: auto; display: flex; align-items: center; }
.privacy-dot { width: 8px; height: 8px; border-radius: 50%; background: #39cb97; box-shadow: 0 0 0 4px rgb(57 203 151 / 12%); }
.sidebar-scrim { display: none; border: 0; padding: 0; }

.workspace { min-height: 100vh; margin-left: 228px; }
.topbar { position: sticky; top: 0; z-index: 25; height: calc(60px + env(safe-area-inset-top)); display: flex; align-items: center; padding: env(safe-area-inset-top) max(28px, env(safe-area-inset-right)) 0 max(28px, env(safe-area-inset-left)); border-bottom: 1px solid var(--line); background: rgb(255 255 255 / 92%); backdrop-filter: blur(16px); }
.top-context { display: flex; align-items: center; gap: 8px; color: var(--blue); font-size: 12px; }
.top-context i { width: 3px; height: 3px; border-radius: 50%; background: #b8c1ce; }
.top-context b { color: var(--muted); font-weight: 500; }
.top-search-button { min-height: 36px; margin-left: auto; border: 1px solid var(--line); border-radius: 9px; padding: 0 12px; background: #fff; color: #526078; display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 12px; font-weight: 650; white-space: nowrap; }
.top-search-button:hover, .top-search-button.active { border-color: #b9cbee; background: var(--blue-soft); color: var(--blue); }
.top-search-button .icon { width: 17px; height: 17px; }
.top-clock { margin-left: 16px; display: flex; align-items: baseline; gap: 10px; color: var(--muted); font-size: 11px; }
.top-clock strong { color: var(--ink); font-size: 15px; }
.notification-button { margin-left: 16px; position: relative; }
.notification-button i { position: absolute; right: 7px; top: 7px; width: 6px; height: 6px; border-radius: 50%; background: #f04463; border: 1.5px solid #fff; }
.account-button { min-width: 0; min-height: 44px; margin-left: 10px; border: 1px solid var(--line); border-radius: 11px; padding: 4px 8px 4px 5px; background: #fff; display: flex; align-items: center; gap: 8px; cursor: pointer; text-align: left; }
.account-button:hover { border-color: #bdc9da; background: #f8fafc; }
.account-button:disabled { cursor: wait; opacity: .65; }
.account-avatar { width: 32px; height: 32px; border-radius: 9px; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; font-size: 12px; font-weight: 800; flex: 0 0 auto; }
.account-copy { max-width: 112px; min-width: 0; display: grid; gap: 1px; }
.account-copy strong, .account-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-copy strong { color: var(--ink); font-size: 11px; }
.account-copy small { color: var(--muted); font-size: 10px; }
.account-button > .icon { width: 15px; color: #8995a8; }
.mobile-menu, .mobile-brand, .mobile-bottom { display: none !important; }
.page-content { max-width: 1500px; margin: 0 auto; padding: 26px max(30px, env(safe-area-inset-right)) 56px max(30px, env(safe-area-inset-left)); }
.page-content:focus { outline: 0; }
.readonly-banner { min-height: 46px; margin-bottom: 16px; border: 1px solid #d7e5fb; border-radius: 11px; padding: 9px 13px; background: var(--blue-soft); color: #36547c; display: flex; align-items: center; gap: 10px; }
.readonly-banner > .icon { width: 18px; color: var(--blue); }
.readonly-banner > span { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px; font-size: 12px; }
.readonly-banner strong { color: var(--ink); }

.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 20px; }
.eyebrow { margin-bottom: 6px; color: var(--blue); font-size: 11px; font-weight: 650; }
.page-header h1 { margin: 0; font-size: clamp(23px, 2.3vw, 30px); line-height: 1.2; letter-spacing: -.02em; }
.page-header h1:focus { outline: 0; }
.page-header h1:focus-visible { outline: 0; text-decoration: underline 2px rgb(31 99 216 / 42%); text-underline-offset: 6px; }
.page-header p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.button { min-height: 40px; border-radius: 9px; border: 1px solid var(--line); padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; font-size: 13px; font-weight: 650; transition: .16s ease; white-space: nowrap; }
.button .icon { width: 16px; height: 16px; }
.button.primary { border-color: var(--blue); color: #fff; background: var(--blue); box-shadow: 0 5px 14px rgb(46 115 237 / 20%); }
.button.primary:hover { background: var(--blue-dark); transform: translateY(-1px); }
.button.secondary { background: #fff; color: #44516a; }
.button.secondary:hover, .button.ghost:hover { border-color: #bdc9da; background: #f8fafc; }
.button.ghost { background: transparent; }
.button.danger { border-color: #ffd1d8; color: var(--red); background: var(--red-soft); }
.button.small { min-height: 36px; padding: 0 11px; font-size: 12px; }
.button.export-download-control { min-height: 44px; }
.button:disabled { opacity: .5; cursor: wait; transform: none !important; }
[data-requires-write]:disabled { cursor: not-allowed; }
.text-button { min-height: 32px; border: 0; padding: 4px; background: none; color: var(--blue); display: inline-flex; align-items: center; gap: 4px; cursor: pointer; font-size: 12px; }
.text-button .icon { width: 14px; height: 14px; }
.icon-button { width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 9px; display: inline-grid; place-items: center; background: #fff; cursor: pointer; }
.icon-button .icon { width: 18px; height: 18px; }
.icon-button.subtle { border: 0; background: transparent; color: #97a2b4; }
.icon-button.subtle:hover { color: var(--red); background: var(--red-soft); }

.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 18px; box-shadow: var(--shadow); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-header h2 { margin: 0; font-size: 15px; }
.card-header p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.stats-grid { display: grid; gap: 12px; margin-bottom: 16px; }
.stats-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-card { min-height: 90px; border: 1px solid var(--line); border-radius: 13px; background: #fff; padding: 15px; display: flex; align-items: flex-start; gap: 12px; box-shadow: var(--shadow); }
.stat-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; }
.stat-icon .icon { width: 18px; }
.stat-card > div { min-width: 0; flex: 1; }
.stat-label { display: block; color: var(--muted); font-size: 12px; }
.stat-card strong { display: block; margin-top: 3px; font-size: 25px; line-height: 1.1; }
.stat-card strong small { padding-left: 3px; color: #65718a; font-size: 11px; }
.stat-card p { margin: 5px 0 0; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tone-blue { color: var(--blue) !important; background-color: var(--blue-soft) !important; }
.tone-mint { color: var(--mint) !important; background-color: var(--mint-soft) !important; }
.tone-purple { color: var(--purple) !important; background-color: var(--purple-soft) !important; }
.tone-amber { color: var(--amber) !important; background-color: var(--amber-soft) !important; }
.tone-pink { color: var(--pink) !important; background-color: var(--pink-soft) !important; }
.tone-cyan { color: var(--cyan) !important; background-color: var(--cyan-soft) !important; }
.tone-red { color: var(--red) !important; background-color: var(--red-soft) !important; }
.tone-neutral { color: #69768e !important; background-color: #f1f4f8 !important; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.62fr) minmax(285px, .85fr); gap: 16px; align-items: start; }
.stack { min-width: 0; display: grid; gap: 16px; }
.quick-grid { display: grid; grid-template-columns: repeat(8, minmax(64px, 1fr)); gap: 8px; }
.quick-action { min-height: 78px; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 9px 5px; display: grid; place-items: center; align-content: center; gap: 8px; cursor: pointer; transition: .16s; }
.quick-action:hover { border-color: #bdc9da; transform: translateY(-2px); box-shadow: 0 8px 18px rgb(28 47 83 / 8%); }
.quick-action > span { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; }
.quick-action .icon { width: 16px; }
.quick-action b { font-size: 11px; font-weight: 600; }
.review-list { display: grid; gap: 8px; }
.review-row { position: relative; min-height: 64px; border: 1px solid var(--line); border-left: 3px solid var(--mint); border-radius: 10px; padding: 10px 10px 10px 12px; display: flex; align-items: center; gap: 10px; }
.review-row.overdue { border-left-color: var(--pink); }
.review-row strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.review-row p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.name-avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 750; flex: 0 0 auto; }
.name-avatar.small { width: 28px; height: 28px; font-size: 10px; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.metric-inline { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px 8px; }
.metric-inline strong { font-size: 21px; }
.metric-inline span { margin-right: 6px; color: var(--muted); font-size: 12px; }
.compact-title { margin: 0 0 12px; font-size: 13px; }
.compact-empty { padding: 24px 8px; color: var(--muted); text-align: center; font-size: 12px; }
.mini-list { display: grid; gap: 2px; margin-top: 10px; }
.mini-list p { margin: 0; padding: 7px 0; border-top: 1px dashed var(--line); display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }
.mini-list p span { color: var(--muted); text-align: right; }
.progress-wrap { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.progress-track { min-width: 70px; height: 7px; overflow: hidden; border-radius: 99px; background: #edf1f6; flex: 1; }
.progress-track i { display: block; height: 100%; border-radius: inherit; background: var(--blue); }
.progress-wrap > span { width: 34px; color: var(--muted); font-size: 11px; text-align: right; }
.todo-list { display: grid; gap: 6px; }
.todo-row { min-height: 42px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 9px; display: flex; align-items: center; gap: 8px; }
.todo-row label { flex: 1; display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13px; }
.todo-row input { width: 17px; height: 17px; accent-color: var(--mint); }
.todo-row.completed label span { color: #9aa5b5; text-decoration: line-through; }
.badge { display: inline-flex; align-items: center; min-height: 23px; padding: 0 7px; border-radius: 99px; background: #f1f4f8; color: #566278; font-size: 11px; white-space: nowrap; }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-green, .badge-mint { background: var(--mint-soft); color: var(--mint); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-amber { background: var(--amber-soft); color: #754500; }
.badge-purple { background: var(--purple-soft); color: var(--purple); }
.weak-list, .stubborn-list { display: grid; }
.weak-row, .stubborn-list > button { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 11px 0; display: flex; align-items: center; gap: 9px; text-align: left; cursor: pointer; }
.weak-row:last-child, .stubborn-list > button:last-child { border-bottom: 0; }
.weak-mark { width: 4px; height: 34px; border-radius: 8px; background: var(--blue); }
.weak-row > span:nth-child(2), .stubborn-list > button > span:nth-child(2) { min-width: 0; flex: 1; display: grid; gap: 4px; }
.weak-row strong, .stubborn-list strong { font-size: 12px; }
.weak-row small, .stubborn-list small { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.weak-row > .icon { width: 14px; color: #a7b1bf; }
.schedule-mini { display: grid; gap: 8px; }
.schedule-mini > div { display: grid; grid-template-columns: 72px 22px 1fr auto; align-items: center; gap: 7px; }
.schedule-mini time { color: var(--muted); font-size: 11px; }
.schedule-mini span { width: 22px; height: 22px; border-radius: 6px; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; font-size: 11px; }
.schedule-mini strong { font-size: 12px; }
.schedule-mini small { color: var(--muted); font-size: 11px; }

.class-page-grid { display: grid; grid-template-columns: minmax(235px, 285px) minmax(0, 1fr); gap: 16px; align-items: start; }
.class-list-card { position: sticky; top: calc(76px + env(safe-area-inset-top)); padding: 12px; }
.class-list-card .card-header { padding: 5px 6px 10px; margin-bottom: 2px; }
.class-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.class-list > li { min-width: 0; }
.class-list-item { width: 100%; min-height: 65px; border: 1px solid transparent; border-radius: 11px; padding: 8px; background: transparent; display: flex; align-items: center; gap: 9px; cursor: pointer; text-align: left; }
.class-list-item:hover { border-color: var(--line); background: #f8fafc; }
.class-list-item.active { border-color: #cadcf9; background: var(--blue-soft); }
.class-list-mark { width: 36px; height: 36px; border-radius: 10px; background: #edf1f7; color: #5d6b82; display: grid; place-items: center; flex: 0 0 auto; font-size: 12px; font-weight: 800; }
.class-list-item.active .class-list-mark { background: var(--blue); color: #fff; }
.class-list-copy { min-width: 0; flex: 1; display: grid; gap: 4px; }
.class-list-copy strong, .class-list-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.class-list-copy strong { font-size: 12px; }
.class-list-copy small { color: var(--muted); font-size: 10px; }
.class-list-count { color: var(--muted); font-size: 10px; white-space: nowrap; }
.roster-card { min-width: 0; padding: 0; overflow: hidden; }
.roster-header { min-height: 88px; padding: 17px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.roster-header .eyebrow { margin: 0 0 5px; }
.roster-header h2 { margin: 0; font-size: 18px; }
.roster-header p:last-child { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.roster-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.roster-stats { min-height: 48px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: #fafbfd; display: flex; align-items: center; flex-wrap: wrap; gap: 10px 22px; color: var(--muted); font-size: 11px; }
.roster-stats strong { color: var(--ink); font-size: 15px; }
.data-table-region { max-width: 100%; overflow: auto; outline-offset: -3px; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table th { height: 42px; padding: 8px 16px; border-bottom: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 11px; font-weight: 650; white-space: nowrap; }
.data-table td { min-height: 48px; padding: 11px 16px; border-bottom: 1px solid var(--line); color: #4b576d; font-size: 12px; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fbfcfe; }
.data-table td strong { color: var(--ink); }
.student-number { font-variant-numeric: tabular-nums; color: var(--blue); font-weight: 650; }
.roster-card > .empty-state { min-height: 330px; display: grid; place-items: center; align-content: center; }
.inline-error { margin: 18px; border: 1px solid #ffd1d8; border-radius: 11px; padding: 13px; background: var(--red-soft); color: var(--red); display: flex; align-items: center; gap: 9px; }
.inline-error .icon { width: 18px; }
.inline-error span { min-width: 0; flex: 1; }
.import-guide { margin-bottom: 18px; border: 1px solid #d6e4fb; border-radius: 11px; padding: 12px 14px; background: var(--blue-soft); color: #375a8d; display: flex; align-items: center; gap: 11px; }
.import-guide > .icon { width: 20px; color: var(--blue); }
.import-guide > span, .import-result header span { display: grid; gap: 3px; }
.import-guide strong, .import-result header strong { color: var(--ink); font-size: 12px; }
.import-guide small, .import-result header small { color: var(--muted); line-height: 1.5; font-size: 11px; }
.import-template-row { margin: -8px 0 16px; border: 1px dashed #cbd9ed; border-radius: 10px; padding: 10px 12px; background: #fbfdff; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.import-template-row p { min-width: 0; margin: 0; display: grid; gap: 3px; }
.import-template-row p strong { color: var(--ink); font-size: 11px; }
.import-template-row p span { color: var(--muted); font-size: 10px; line-height: 1.5; }
.import-template-row .button { flex: 0 0 auto; }
.import-result { margin-top: 18px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.import-result:focus { outline: 3px solid rgb(31 99 216 / 45%); outline-offset: 2px; }
.import-result > header { padding: 12px 14px; background: #fafbfd; }
.import-result > header > div { display: flex; align-items: center; gap: 9px; }
.import-result > header .icon { width: 18px; }
.import-result.invalid { border-color: #ffd1d8; }
.import-result.invalid > header { background: var(--red-soft); }
.import-result.invalid > header .icon { color: var(--red); }
.import-result.valid { margin: 0; }
.import-result.valid > header { background: var(--mint-soft); }
.import-result.valid > header .icon { color: var(--mint); }
.import-error-list { max-height: 290px; overflow: auto; margin: 0; padding: 8px 14px 12px; list-style: none; display: grid; gap: 7px; }
.import-error-list li { border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; background: #fff; display: grid; grid-template-columns: auto 1fr; gap: 4px 9px; }
.import-error-list code { align-self: start; border-radius: 5px; padding: 3px 5px; background: #f1f4f8; color: var(--red); font-size: 10px; }
.import-error-list strong { font-size: 11px; }
.import-error-list p { grid-column: 2; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.import-preview-table { max-height: min(420px, 48vh); }
.table-overflow-note { margin: 0; padding: 10px 14px; border-top: 1px solid var(--line); color: var(--muted); text-align: center; font-size: 11px; }
.import-safety-note { margin: 0; padding: 12px 14px; border-top: 1px solid var(--line); background: #fffaf0; color: #765316; font-size: 11px; line-height: 1.6; }
.import-confirm-actions { padding: 13px 14px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 9px; }

.tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tab { position: relative; min-height: 44px; border: 0; background: none; color: var(--muted); padding: 0 2px; cursor: pointer; white-space: nowrap; font-size: 13px; }
.tab span { margin-left: 5px; }
.tab.active { color: var(--blue); font-weight: 650; }
.tab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--blue); }
.placeholder-card { min-height: 420px; display: grid; place-items: center; }
.empty-state { max-width: 340px; margin: auto; padding: 30px; text-align: center; color: var(--muted); }
.empty-state > .icon { width: 40px; height: 40px; color: #a9b6c8; }
.empty-state h3 { margin: 14px 0 5px; color: var(--ink); }
.empty-state p { margin: 0; font-size: 13px; line-height: 1.7; }

.modal-open { overflow: hidden; }
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 22px; background: rgb(10 18 33 / 54%); backdrop-filter: blur(4px); animation: fade-in .15s ease; }
.modal { width: min(520px, 100%); max-height: min(760px, calc(100vh - 44px)); max-height: min(760px, calc(100dvh - 44px)); overflow: hidden; border-radius: 16px; background: #fff; box-shadow: 0 28px 90px rgb(6 15 32 / 25%); display: flex; flex-direction: column; animation: modal-in .2s ease; }
.modal-wide { width: min(820px, 100%); }
.modal-xl { width: min(1080px, 100%); }
.modal-header { min-height: 64px; padding: 14px 18px 14px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-header h2 { margin: 0; font-size: 17px; }
.modal-form { min-height: 0; display: flex; flex-direction: column; }
.modal-body { min-height: 0; overflow: auto; padding: 20px 22px; }
.modal-footer { min-height: 66px; padding: 13px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 9px; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.field { display: grid; gap: 7px; margin-bottom: 15px; }
.field > span { color: #4e596d; font-size: 13px; font-weight: 600; }
.field > span b { color: var(--red); margin-left: 2px; }
.field input, .field select, .field textarea, .search-box input { width: 100%; border: 1px solid #cbd5e2; border-radius: 9px; background: #fff; color: var(--ink); padding: 10px 11px; font-size: 14px; transition: .15s; }
.field textarea { resize: vertical; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus, .search-box input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgb(31 99 216 / 18%); outline: 3px solid rgb(31 99 216 / 72%); outline-offset: 1px; }
.form-hint { margin: -3px 0 16px; color: var(--muted); line-height: 1.65; font-size: 12px; }
.judge-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.judge-options label { cursor: pointer; }
.judge-options input { position: absolute; opacity: 0; }
.judge-options span { min-height: 74px; border: 1px solid var(--line); border-radius: 12px; display: grid; place-items: center; align-content: center; gap: 7px; font-weight: 650; }
.judge-options input:checked + span { border-color: currentColor; box-shadow: 0 0 0 3px currentColor inset; }
.judge-options input:focus-visible + span { outline: 3px solid rgb(31 99 216 / 72%); outline-offset: 3px; }
.judge-good { color: var(--mint); background: var(--mint-soft); }
.judge-retry { color: var(--amber); background: var(--amber-soft); }
.confirm-message { display: flex; align-items: center; gap: 14px; padding: 12px 0; }
.confirm-message .icon { width: 34px; height: 34px; color: var(--amber); }
.confirm-message p { margin: 0; line-height: 1.6; }

#toast-root { position: fixed; z-index: 160; right: max(24px, env(safe-area-inset-right)); top: max(22px, env(safe-area-inset-top)); display: grid; gap: 8px; pointer-events: none; }
.toast { min-width: 230px; max-width: 380px; min-height: 48px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 11px; background: #fff; box-shadow: 0 16px 40px rgb(15 28 51 / 18%); display: flex; align-items: center; gap: 9px; opacity: 0; transform: translateY(-8px); transition: .22s; }
.toast.show { opacity: 1; transform: none; }
.toast .icon { width: 18px; color: var(--mint); }
.toast-error .icon { color: var(--red); }
.toast span { font-size: 13px; }

@media (max-width: 1180px) {
  .quick-grid { grid-template-columns: repeat(4, 1fr); }
  .stats-grid.four { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1050px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-aside { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  body.nav-open { overflow: hidden; }
  .sidebar { width: 250px; transform: translateX(-105%); transition: transform .25s ease; box-shadow: 20px 0 50px rgb(3 11 25 / 22%); }
  .nav-open .sidebar { transform: translateX(0); }
  .sidebar-close { display: inline-grid !important; border: 0; background: rgb(255 255 255 / 6%); color: #fff; }
  .sidebar-footer { width: 250px; transform: translateX(-105%); transition: transform .25s ease; }
  .nav-open .sidebar-footer { transform: translateX(0); }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 35; display: block; pointer-events: none; opacity: 0; background: rgb(6 13 25 / 45%); transition: .2s; }
  .nav-open .sidebar-scrim { pointer-events: auto; opacity: 1; }
  .workspace { margin-left: 0; }
  .topbar { padding: env(safe-area-inset-top) max(18px, env(safe-area-inset-right)) 0 max(18px, env(safe-area-inset-left)); }
  .mobile-menu { display: inline-grid !important; margin-right: 8px; }
  .mobile-brand { min-width: 0; flex: 1; display: flex !important; align-items: center; gap: 8px; }
  .mobile-brand > span { width: 29px; height: 29px; border-radius: 8px; font-size: 12px; }
  .mobile-brand strong { min-width: 0; display: grid; gap: 1px; font-size: 13px; }
  .mobile-brand small { min-width: 0; overflow: hidden; color: var(--muted); font-size: 11px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
  .top-context { display: none; }
  .account-copy { display: none; }
  .account-button { min-width: 44px; width: 44px; padding: 5px; justify-content: center; }
  .account-button .account-avatar { display: none; }
  .account-button > .icon { width: 18px; }
  .page-content { padding: 22px max(20px, env(safe-area-inset-right)) calc(82px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-aside { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .class-page-grid { grid-template-columns: 1fr; }
  .class-list-card { position: static; }
  .class-list { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
}

@media (max-width: 820px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-story { display: none; }
  .auth-panel { padding: max(30px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(30px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left)); }
  .auth-mobile-brand { margin: 0 0 54px; display: flex; align-items: center; gap: 9px; color: var(--ink); font-size: 13px; font-weight: 750; }
  .auth-mobile-brand > span { width: 34px; height: 34px; border-radius: 10px; font-size: 15px; }
}

@media (max-width: 640px) {
  body { font-size: 13px; }
  .topbar { height: calc(54px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left)); }
  .mobile-menu, .sidebar-close { width: 44px; height: 44px; }
  .mobile-brand > span { display: none; }
  .top-clock span { display: none; }
  .top-clock strong { font-size: 13px; }
  .notification-button { margin-left: 7px; width: 44px; height: 44px; }
  .account-button { margin-left: 5px; }
  .page-content { padding: 18px max(13px, env(safe-area-inset-right)) calc(84px + env(safe-area-inset-bottom)) max(13px, env(safe-area-inset-left)); }
  .page-header { align-items: flex-start; flex-wrap: wrap; margin-bottom: 16px; }
  .page-header p { line-height: 1.6; }
  .page-actions { justify-content: flex-start; }
  .page-actions .button { min-height: 44px; padding: 0 12px; }
  .stats-grid.four { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { min-height: 82px; padding: 12px; gap: 9px; }
  .stat-icon { width: 31px; height: 31px; }
  .stat-card strong { font-size: 20px; }
  .card { padding: 14px; border-radius: 12px; }
  .quick-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .quick-action { min-height: 69px; }
  .quick-action b { font-size: 11px; }
  .review-row { align-items: flex-start; flex-wrap: wrap; }
  .review-row .button { margin-left: 44px; }
  .two-column, .dashboard-aside { grid-template-columns: 1fr; }
  .class-list { display: flex; overflow-x: auto; padding-bottom: 3px; scroll-snap-type: x proximity; }
  .class-list > li { flex: 0 0 auto; }
  .class-list-item { min-width: min(245px, 82vw); scroll-snap-align: start; }
  .roster-header { align-items: flex-start; flex-wrap: wrap; }
  .roster-actions { width: 100%; justify-content: flex-start; }
  .roster-actions .button { min-height: 44px; }
  .roster-stats { gap: 8px 15px; }
  .student-table, .student-table tbody, .student-table tr, .student-table td { display: block; }
  .student-table thead { display: none; }
  .student-table tbody { padding: 10px; display: grid; gap: 8px; }
  .student-table tr { border: 1px solid var(--line); border-radius: 10px; padding: 7px 0; background: #fff; }
  .student-table td { min-height: 32px; padding: 6px 11px; border: 0; display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 9px; align-items: center; }
  .student-table td::before { content: attr(data-label); color: var(--muted); font-size: 10px; font-weight: 650; }
  .import-template-row { align-items: stretch; flex-direction: column; }
  .import-template-row .button { width: 100%; min-height: 44px; }
  .import-confirm-actions { flex-direction: column-reverse; }
  .import-confirm-actions .button { width: 100%; min-height: 44px; }
  .mobile-bottom { position: fixed; inset: auto 0 0 0; z-index: 30; height: calc(62px + env(safe-area-inset-bottom)); padding: 6px max(8px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(8px, env(safe-area-inset-left)); border-top: 1px solid var(--line); background: rgb(255 255 255 / 96%); backdrop-filter: blur(16px); display: grid !important; grid-template-columns: repeat(5, 1fr); }
  .mobile-bottom button { min-width: 44px; min-height: 44px; border: 0; background: none; color: #68758a; display: grid; place-items: center; align-content: center; gap: 2px; font-size: 11px; }
  .mobile-bottom button.active { border-radius: 10px; background: var(--blue-soft); color: var(--blue); font-weight: 750; }
  .mobile-bottom .icon { width: 19px; height: 19px; }
  .modal-backdrop { padding: 0; align-items: end; }
  .modal { width: 100%; max-height: 92vh; max-height: 92dvh; border-radius: 18px 18px 0 0; }
  .modal-body { padding: 18px 16px; }
  .modal-footer { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .field input, .field select, .field textarea, .search-box input { font-size: 16px; }
  #toast-root { top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); left: max(12px, env(safe-area-inset-left)); }
  .toast { min-width: 0; max-width: none; width: 100%; }
  .auth-panel { place-items: start center; }
  .auth-form-wrap h1 { font-size: 26px; }
  .auth-help { margin-bottom: 24px; }
}

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

@media print {
  .sidebar, .topbar, .mobile-bottom, .page-actions, #toast-root { display: none !important; }
  .workspace { margin: 0; }
  .page-content { max-width: none; padding: 0; }
  body { background: #fff; }
  .card, .stat-card { box-shadow: none; break-inside: avoid; }
}

/* M4 · 作业情况 */
.homework-filters { margin-bottom: 16px; padding: 13px 14px; display: grid; grid-template-columns: repeat(6, minmax(118px, 1fr)) auto; align-items: end; gap: 10px; box-shadow: none; }
.homework-filters label, .homework-matrix-filters label, .homework-batch-toolbar label { min-width: 0; display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 650; }
.homework-filters input, .homework-filters select, .homework-matrix-filters input, .homework-matrix-filters select, .homework-batch-toolbar input, .homework-batch-toolbar select { width: 100%; min-height: 38px; border: 1px solid #cbd5e2; border-radius: 9px; padding: 7px 9px; background: #fff; color: var(--ink); }
.homework-search-filter { grid-column: span 2; }
.homework-search-filter .search-box { min-width: 0; }
.homework-search-filter .search-box input { min-height: 38px; padding-left: 35px; }
.homework-snapshot-note { margin-bottom: 12px; }
.homework-list { min-width: 0; display: grid; gap: 11px; }
.homework-card { min-width: 0; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 14px; }
.homework-card.draft { border-left: 3px solid #b9c3d2; }
.homework-card-mark { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; }
.homework-card-mark .icon { width: 20px; }
.homework-card-copy { min-width: 0; display: grid; gap: 9px; }
.homework-card-heading { min-width: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.homework-card-heading > div { min-width: 0; }
.homework-card-heading h2 { overflow: hidden; margin: 0; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.homework-card-heading p, .homework-due { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.homework-due { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; }
.homework-due strong { color: var(--red); }
.homework-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.homework-card-metrics { margin: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 22px; }
.homework-card-metrics > div { display: flex; align-items: baseline; gap: 5px; }
.homework-card-metrics dt { color: var(--muted); font-size: 10px; }
.homework-card-metrics dd { margin: 0; color: var(--ink); font-size: 13px; font-weight: 720; }
.homework-load-more { justify-self: center; min-width: 170px; margin: 8px 0; }
.homework-loading, .homework-state { min-height: 300px; display: grid; place-items: center; }
.homework-list-stats .stat-card, .homework-detail-stats .stat-card { min-width: 0; }
.homework-detail-tabs { margin-bottom: 16px; padding: 0 18px; box-shadow: none; }
.homework-detail-tabs .tabs { border-bottom: 0; }
.homework-conflict { min-height: 58px; margin-bottom: 14px; border: 1px solid #f4ca73; border-radius: 12px; padding: 10px 13px; background: #fff9e9; color: #754f04; display: flex; align-items: center; gap: 10px; }
.homework-conflict > .icon { width: 20px; flex: 0 0 auto; }
.homework-conflict > span { min-width: 0; flex: 1; display: grid; gap: 2px; font-size: 11px; line-height: 1.5; }
.homework-conflict strong { color: var(--ink); }
.homework-overview-grid { min-width: 0; display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(260px, .7fr); align-items: start; gap: 16px; }
.homework-overview-main { min-width: 0; }
.homework-definition-list { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
.homework-definition-list > div { min-width: 0; padding: 12px 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; }
.homework-definition-list > div:nth-child(odd) { padding-right: 18px; }
.homework-definition-list dt { color: var(--muted); font-size: 11px; }
.homework-definition-list dd { min-width: 0; overflow-wrap: anywhere; margin: 0; color: var(--ink); font-size: 12px; font-weight: 620; }
.homework-description, .homework-tags-block { border-top: 1px solid var(--line); padding-top: 14px; }
.homework-description h3, .homework-tags-block h3, .homework-maintenance h2 { margin: 0 0 8px; font-size: 13px; }
.homework-description p, .homework-maintenance p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
.homework-tags-block { margin-top: 14px; }
.homework-tags-block > div { display: flex; flex-wrap: wrap; gap: 6px; }
.muted-copy { color: var(--muted); font-size: 12px; }
.homework-overview-side { min-width: 0; display: grid; gap: 12px; }
.integration-note { min-width: 0; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 11px; box-shadow: none; }
.integration-note > .icon { width: 22px; color: var(--blue); }
.integration-note h2 { margin: 0 0 5px; font-size: 13px; }
.integration-note p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.65; }
.homework-maintenance { display: grid; gap: 9px; }
.homework-maintenance .button { width: 100%; }
.homework-matrix-card { min-width: 0; padding: 0; overflow: hidden; }
.homework-matrix-card > .card-header { margin: 0; padding: 16px 18px; }
.homework-matrix-filters { padding: 12px 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fafbfd; display: grid; grid-template-columns: minmax(140px, .65fr) minmax(190px, 1fr) auto auto; align-items: end; gap: 10px; }
.homework-check-filter { min-height: 38px; display: flex !important; align-items: center; grid-auto-flow: column; justify-content: start; }
.homework-check-filter input, .homework-page-select input { width: 17px; min-height: 17px; height: 17px; accent-color: var(--blue); }
.homework-batch-toolbar { padding: 12px 18px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: auto auto repeat(4, minmax(115px, 1fr)) auto; align-items: end; gap: 9px; }
.homework-batch-toolbar > strong { align-self: center; color: var(--ink); font-size: 12px; white-space: nowrap; }
.homework-page-select { min-height: 38px; display: flex !important; align-items: center; flex-direction: row; gap: 6px !important; white-space: nowrap; }
.homework-viewer-note { min-height: 46px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 12px 18px; background: var(--blue-soft); color: #36547c; font-size: 11px; }
.homework-matrix-region { max-width: 100%; max-height: min(640px, 65vh); overflow: auto; }
.homework-matrix-table { min-width: 860px; }
.homework-matrix-table thead th { position: sticky; z-index: 4; top: 0; }
.homework-matrix-table .matrix-select-cell { position: sticky; z-index: 3; left: 0; width: 48px; background: #fff; text-align: center; }
.homework-matrix-table thead .matrix-select-cell { z-index: 6; }
.homework-matrix-table .matrix-student-cell { position: sticky; z-index: 2; left: 48px; min-width: 170px; background: #fff; box-shadow: 1px 0 var(--line); }
.homework-matrix-table thead .matrix-student-cell { z-index: 5; }
.homework-matrix-table tr.selected td { background-color: #f4f8ff; }
.homework-matrix-table .matrix-select-cell input { width: 18px; height: 18px; accent-color: var(--blue); }
.homework-matrix-table .matrix-student-cell { display: table-cell; }
.homework-matrix-table .matrix-student-cell strong, .homework-matrix-table .matrix-student-cell small { display: block; }
.homework-matrix-table .matrix-student-cell small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.matrix-score { color: var(--ink) !important; font-variant-numeric: tabular-nums; font-weight: 700; }
.homework-matrix-empty { min-height: 280px; display: grid; place-items: center; }
.homework-pagination { min-height: 60px; border-top: 1px solid var(--line); padding: 10px 18px; display: flex; align-items: center; justify-content: center; gap: 14px; }
.homework-pagination span { color: var(--muted); font-size: 11px; }
.homework-transfer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.transfer-card { min-width: 0; min-height: 170px; display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: start; gap: 12px; }
.transfer-card > .icon { width: 25px; color: var(--blue); }
.transfer-card h2 { margin: 0; font-size: 14px; }
.transfer-card p { min-height: 48px; margin: 8px 0 14px; color: var(--muted); font-size: 11px; line-height: 1.65; }
.transfer-card.integration-disabled { opacity: .72; }
.homework-sync-list { max-height: 320px; overflow: auto; margin: 0 0 16px; padding: 0; list-style: none; display: grid; }
.homework-sync-list li { min-width: 0; border-bottom: 1px solid var(--line); padding: 9px 4px; display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }
.homework-sync-list span { color: var(--muted); }
.import-result.warning { border-color: #f2d28e; }
.import-result.warning > header { background: #fff8e7; }
.import-result.warning > header .icon { color: #a66a00; }

@media (max-width: 1280px) {
  .homework-filters { grid-template-columns: repeat(4, minmax(120px, 1fr)); }
  .homework-batch-toolbar { grid-template-columns: repeat(4, minmax(120px, 1fr)); }
  .homework-batch-toolbar > strong, .homework-page-select { align-self: end; }
}

@media (max-width: 900px) {
  .homework-filters { grid-template-columns: repeat(3, minmax(120px, 1fr)); }
  .homework-overview-grid { grid-template-columns: 1fr; }
  .homework-overview-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .homework-matrix-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .homework-batch-toolbar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .homework-filters { grid-template-columns: 1fr; padding: 12px; }
  .homework-search-filter { grid-column: auto; }
  .homework-filters .button { min-height: 44px; }
  .homework-card { grid-template-columns: 34px minmax(0, 1fr); padding: 13px; gap: 10px; }
  .homework-card-mark { width: 34px; height: 34px; }
  .homework-card-heading { align-items: flex-start; }
  .homework-card-heading h2 { white-space: normal; overflow-wrap: anywhere; }
  .homework-card-metrics { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .homework-open { grid-column: 1 / -1; width: 100%; min-height: 44px; }
  .homework-conflict { align-items: flex-start; flex-wrap: wrap; }
  .homework-conflict .button { width: 100%; }
  .homework-definition-list { grid-template-columns: 1fr; }
  .homework-definition-list > div:nth-child(odd) { padding-right: 0; }
  .homework-overview-side, .homework-transfer-grid { grid-template-columns: 1fr; }
  .homework-matrix-filters, .homework-batch-toolbar { grid-template-columns: 1fr; padding: 12px; }
  .homework-batch-toolbar .button { min-height: 44px; }
  .homework-matrix-region { max-height: none; overflow: visible; padding: 10px; }
  .homework-matrix-table, .homework-matrix-table tbody, .homework-matrix-table tr, .homework-matrix-table td { width: 100%; min-width: 0; display: block; }
  .homework-matrix-table thead { display: none; }
  .homework-matrix-table tbody { display: grid; gap: 9px; }
  .homework-matrix-table tr { overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
  .homework-matrix-table td, .homework-matrix-table .matrix-select-cell, .homework-matrix-table .matrix-student-cell { position: static; width: 100%; min-height: 38px; border: 0; border-bottom: 1px solid #eef1f5; padding: 8px 11px; background: transparent; box-shadow: none; display: grid; grid-template-columns: 78px minmax(0, 1fr); align-items: center; gap: 9px; text-align: left; }
  .homework-matrix-table td:last-child { border-bottom: 0; }
  .homework-matrix-table td::before { content: attr(data-label); color: var(--muted); font-size: 10px; font-weight: 650; }
  .homework-matrix-table .matrix-student-cell strong, .homework-matrix-table .matrix-student-cell small { grid-column: 2; }
  .homework-matrix-table .matrix-student-cell small { margin: -3px 0 0; }
  .homework-matrix-table td .button { width: fit-content; min-height: 40px; }
  .homework-pagination { padding: 10px 12px; flex-wrap: wrap; gap: 7px; }
  .homework-pagination span { width: 100%; order: -1; text-align: center; }
  .homework-pagination .button { flex: 1; min-height: 44px; }
  .transfer-card { min-height: 0; }
}

/* M3 · 今日、日历与提醒 */
.flip-x { transform: scaleX(-1); }
.danger-text { color: var(--red) !important; }
.today-filters, .calendar-filters { margin-bottom: 16px; padding: 12px 14px; display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)) auto; align-items: end; gap: 10px; box-shadow: none; }
.today-filters label, .calendar-filters label, .reminder-toolbar form label { min-width: 0; display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 650; }
.today-filters input, .today-filters select, .calendar-filters select, .reminder-toolbar select { width: 100%; min-height: 38px; border: 1px solid #cbd5e2; border-radius: 9px; padding: 7px 9px; background: #fff; color: var(--ink); }
.today-card-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.today-provider { min-width: 0; min-height: 118px; border: 1px solid var(--line); border-radius: 13px; padding: 13px; background: #fff; box-shadow: var(--shadow); text-align: left; }
button.today-provider { cursor: pointer; transition: .16s ease; }
button.today-provider:hover { border-color: #becbe0; transform: translateY(-2px); box-shadow: 0 10px 24px rgb(24 40 72 / 9%); }
.today-provider.available { display: grid; grid-template-columns: 36px minmax(0, 1fr) 16px; align-items: start; gap: 10px; }
.today-provider.available > span:nth-child(2) { min-width: 0; display: grid; gap: 4px; }
.today-provider.available small, .today-provider.unavailable small { color: var(--muted); font-size: 10px; }
.today-provider.available strong, .today-provider.unavailable h2 { overflow: hidden; margin: 0; color: var(--ink); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.today-provider.available em { color: var(--blue); font-size: 17px; font-style: normal; font-weight: 780; }
.today-provider.available > .icon { align-self: center; width: 15px; color: #9aa6b9; }
.today-provider.unavailable { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 10px; opacity: .72; }
.today-provider.unavailable > div { min-width: 0; display: grid; gap: 4px; }
.today-provider.unavailable p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.today-provider.unavailable > .badge { grid-column: 2; justify-self: start; }
.today-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.today-detail-grid.with-homework { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.today-source-list { margin: 0; padding: 0; list-style: none; display: grid; }
.today-source-list li { min-width: 0; min-height: 58px; padding: 9px 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 54px 4px minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.today-source-list li:first-child { border-top: 0; }
.source-time { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.source-mark { width: 4px; height: 34px; border-radius: 99px; }
.source-copy { min-width: 0; display: grid; gap: 4px; }
.source-copy strong, .source-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-copy strong { font-size: 12px; }
.source-copy small { color: var(--muted); font-size: 10px; }
.today-detail-grid .empty-state { padding: 26px 10px; }

.calendar-toolbar { margin-bottom: 16px; padding: 10px 14px 0; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; box-shadow: none; }
.calendar-range-controls { min-height: 44px; padding-bottom: 10px; display: flex; align-items: center; gap: 7px; }
.calendar-range-controls h2 { margin: 0 0 0 7px; font-size: 16px; }
.calendar-toolbar .tabs { min-width: 170px; justify-content: space-around; }
.month-card { margin-bottom: 16px; padding: 0; overflow: hidden; }
.month-weekdays, .month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.month-weekdays { min-height: 36px; border-bottom: 1px solid var(--line); background: #fafbfd; align-items: center; text-align: center; color: var(--muted); font-size: 10px; }
.month-day { position: relative; min-width: 0; min-height: 76px; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 8px; background: #fff; cursor: pointer; text-align: left; }
.month-day:nth-child(7n) { border-right: 0; }
.month-day:nth-last-child(-n + 7) { border-bottom: 0; }
.month-day:hover { background: var(--blue-soft); }
.month-day.outside { background: #fbfcfd; color: #aab3c1; }
.month-day time { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; }
.month-day.today time { background: var(--blue); color: #fff; font-weight: 750; }
.month-day > span { position: absolute; right: 8px; bottom: 8px; min-height: 16px; display: flex; align-items: center; gap: 3px; color: var(--blue); font-size: 9px; }
.month-day > span i { width: 5px; height: 5px; border-radius: 50%; background: var(--blue); }
.agenda { display: grid; gap: 12px; }
.agenda-day { padding: 0; overflow: hidden; }
.agenda-day > header { min-height: 46px; padding: 11px 16px; border-bottom: 1px solid var(--line); background: #fafbfd; display: flex; align-items: center; justify-content: space-between; }
.agenda-day > header time { font-size: 13px; font-weight: 700; }
.agenda-day > header span { color: var(--muted); font-size: 11px; }
.agenda-day ol { margin: 0; padding: 0; list-style: none; }
.agenda-item { min-width: 0; min-height: 82px; padding: 12px 16px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 120px 34px minmax(160px, 1fr) auto auto; align-items: center; gap: 11px; }
.agenda-item:last-child { border-bottom: 0; }
.agenda-time { color: #435069; font-size: 11px; font-variant-numeric: tabular-nums; }
.agenda-type { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; }
.agenda-type .icon { width: 16px; }
.agenda-copy { min-width: 0; display: grid; gap: 4px; }
.agenda-copy > div { min-width: 0; display: flex; align-items: center; gap: 7px; }
.agenda-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.agenda-copy p, .agenda-copy small { overflow: hidden; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; text-overflow: ellipsis; white-space: nowrap; }
.event-actions { justify-self: end; display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 2px 6px; }
.event-actions .text-button { min-height: 28px; font-size: 10px; }
.event-actions .icon { width: 13px; }
.calendar-empty, .reminder-empty { min-height: 300px; display: grid; place-items: center; }
.checkbox-field .check-control { min-height: 42px; border: 1px solid #cbd5e2; border-radius: 9px; padding: 10px 11px; display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 500; }
.checkbox-field input { width: 17px; height: 17px; accent-color: var(--blue); }
.recurrence-fields { border-top: 1px solid var(--line); padding-top: 15px; }
.recurrence-fields h3 { margin: 0 0 13px; font-size: 14px; }
.weekday-options { margin: 0 0 15px; border: 0; padding: 0; }
.weekday-options legend { margin-bottom: 7px; color: #4e596d; font-size: 13px; font-weight: 600; }
.weekday-options label { display: inline-block; margin: 0 5px 5px 0; cursor: pointer; }
.weekday-options input { position: absolute; opacity: 0; }
.weekday-options span { min-width: 42px; min-height: 34px; border: 1px solid var(--line); border-radius: 8px; display: grid; place-items: center; color: var(--muted); font-size: 11px; }
.weekday-options input:checked + span { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); font-weight: 700; }
.weekday-options input:focus-visible + span { outline: 3px solid rgb(31 99 216 / 72%); outline-offset: 2px; }
.recurrence-terminal { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.reminder-toolbar { margin-bottom: 16px; padding: 0 14px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; box-shadow: none; }
.source-filter-note { min-height: 44px; margin-bottom: 10px; border: 1px solid #d6e4fb; border-radius: 11px; padding: 8px 12px; background: var(--blue-soft); color: #375a8d; display: flex; align-items: center; gap: 9px; font-size: 11px; }
.source-filter-note > .icon { width: 17px; color: var(--blue); }
.source-filter-note > span { min-width: 0; flex: 1; }
.reminder-toolbar .tabs { flex: 1; }
.reminder-toolbar form { min-width: 270px; padding: 8px 0; display: grid; grid-template-columns: minmax(150px, 1fr) auto; align-items: end; gap: 8px; }
.reminder-list { display: grid; gap: 10px; }
.reminder-card { min-height: 96px; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 13px; }
.reminder-card.overdue { border-left: 3px solid var(--red); }
.reminder-priority { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; }
.reminder-priority .icon { width: 18px; }
.reminder-copy { min-width: 0; display: grid; gap: 6px; }
.reminder-copy > div { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.reminder-copy h2 { min-width: 0; overflow: hidden; margin: 0; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.reminder-copy p { margin: 0; display: flex; flex-wrap: wrap; gap: 6px 13px; color: var(--muted); font-size: 11px; }
.reminder-copy small { overflow: hidden; color: #4f5b70; font-size: 11px; line-height: 1.55; text-overflow: ellipsis; white-space: nowrap; }
.reminder-copy em { color: var(--purple); font-size: 10px; font-style: normal; }
.reminder-actions { display: flex; align-items: center; gap: 7px; }
.reminder-load-more { justify-self: center; min-width: 150px; margin: 8px 0; }

@media (max-width: 1250px) {
  .today-card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .today-detail-grid.with-homework { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .today-detail-grid.with-homework > article:last-child { grid-column: 1 / -1; }
  .agenda-item { grid-template-columns: 100px 34px minmax(150px, 1fr) auto; }
  .agenda-item > .event-actions { grid-column: 3 / -1; justify-self: start; }
}

@media (max-width: 900px) {
  .today-filters, .calendar-filters { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
  .today-detail-grid { grid-template-columns: 1fr; }
  .today-detail-grid.with-homework { grid-template-columns: 1fr; }
  .today-detail-grid.with-homework > article:last-child { grid-column: auto; }
  .calendar-toolbar, .reminder-toolbar { align-items: stretch; flex-direction: column; }
  .calendar-toolbar { padding-top: 12px; }
  .calendar-toolbar .tabs, .reminder-toolbar .tabs { width: 100%; }
  .reminder-toolbar form { min-width: 0; }
}

@media (max-width: 640px) {
  .today-filters, .calendar-filters { grid-template-columns: 1fr; }
  .today-filters .button, .calendar-filters .button { min-height: 44px; }
  .today-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .today-provider { min-height: 108px; padding: 11px; }
  .today-provider.available { grid-template-columns: 31px minmax(0, 1fr); }
  .today-provider.available > .icon { display: none; }
  .today-provider .stat-icon { width: 31px; height: 31px; }
  .today-source-list li { grid-template-columns: 46px 4px minmax(0, 1fr); }
  .today-source-list li > .badge { grid-column: 3; justify-self: start; }
  .today-homework-sources li > .text-button { grid-column: 3; justify-self: start; }
  .calendar-range-controls { flex-wrap: wrap; }
  .calendar-range-controls h2 { width: 100%; margin: 5px 0 0; }
  .month-weekdays span { font-size: 9px; }
  .month-day { min-height: 54px; padding: 5px; }
  .month-day > span { right: 5px; bottom: 5px; }
  .month-day > span i:nth-child(n + 3) { display: none; }
  .agenda-item { padding: 12px; grid-template-columns: 82px 30px minmax(0, 1fr); align-items: start; }
  .agenda-type { width: 30px; height: 30px; }
  .agenda-item > .badge { grid-column: 3; justify-self: start; }
  .agenda-item > .event-actions { grid-column: 1 / -1; justify-self: stretch; justify-content: flex-start; padding-left: 0; }
  .event-actions .text-button { min-height: 38px; }
  .recurrence-terminal { grid-template-columns: 1fr; gap: 0; }
  .reminder-toolbar { padding: 0 10px 10px; }
  .reminder-toolbar form { grid-template-columns: 1fr; }
  .reminder-card { grid-template-columns: 34px minmax(0, 1fr); align-items: start; padding: 13px; }
  .reminder-priority { width: 34px; height: 34px; }
  .reminder-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .reminder-actions .button { min-height: 42px; }
}

/* M5 · 教案库与八段纯文本编辑器 */
.lesson-filters { margin-bottom: 16px; padding: 13px 14px; display: grid; grid-template-columns: minmax(220px, 2fr) minmax(130px, 1fr) minmax(170px, 1.35fr) minmax(120px, .8fr) auto auto; align-items: end; gap: 10px; box-shadow: none; }
.lesson-filters label, .lesson-meta-grid label { min-width: 0; display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 650; }
.lesson-filters input, .lesson-filters select, .lesson-meta-grid input, .lesson-meta-grid select { width: 100%; min-height: 40px; border: 1px solid #cbd5e2; border-radius: 9px; padding: 8px 10px; background: #fff; color: var(--ink); }
.lesson-filters .search-box { min-width: 0; }
.lesson-filters > .text-button { min-height: 40px; padding-inline: 8px; }
.lesson-list { display: grid; gap: 10px; }
.lesson-card { min-width: 0; min-height: 124px; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 14px; }
.lesson-card-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; }
.lesson-card-icon .icon { width: 20px; }
.lesson-card-copy { min-width: 0; display: grid; gap: 7px; }
.lesson-card-title { min-width: 0; display: flex; align-items: center; gap: 8px; }
.lesson-card-title h2 { min-width: 0; overflow: hidden; margin: 0; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.lesson-card-copy p { margin: 0; display: flex; flex-wrap: wrap; gap: 5px 9px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.lesson-card-tags, .lesson-meta-view [data-view-tags] { display: flex; flex-wrap: wrap; gap: 5px; }
.lesson-open .icon { width: 14px; }
.lesson-load-more { justify-self: center; min-width: 150px; margin: 8px 0; }
.lesson-state { min-height: 290px; display: grid; place-items: center; }
.lesson-state > .empty-state > .button { margin-top: 12px; }

.lesson-save-cluster, .lesson-readonly-state { position: sticky; z-index: 7; top: 8px; min-height: 42px; margin: -4px 0 10px; border: 1px solid var(--line); border-radius: 11px; padding: 8px 12px; background: rgb(255 255 255 / 94%); box-shadow: 0 7px 24px rgb(24 40 72 / 8%); backdrop-filter: blur(8px); }
.lesson-save-cluster { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.lesson-save-status { color: #267255; font-size: 11px; font-weight: 750; }
.lesson-save-status[data-state="pending"], .lesson-save-status[data-state="saving"] { color: #315f9f; }
.lesson-save-status[data-state="conflict"], .lesson-save-status[data-state="error"] { color: var(--red); }
.lesson-save-cluster kbd { border: 1px solid #d7dde7; border-radius: 5px; padding: 1px 4px; background: #f7f8fa; color: var(--muted); font: inherit; }
.lesson-readonly-state { display: flex; align-items: center; color: var(--muted); font-size: 11px; }
.lesson-save-alert { margin-bottom: 10px; border: 1px solid #efc7c5; border-radius: 11px; padding: 10px 12px; background: #fff5f4; color: #8a3732; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 11px; }
.lesson-save-alert[hidden] { display: none; }
.lesson-save-alert > div { flex: 0 0 auto; display: flex; gap: 7px; }

.lesson-meta-editor, .lesson-meta-view { margin-bottom: 12px; padding: 16px; }
.lesson-meta-editor h2, .lesson-meta-view h2 { margin: 0; font-size: 14px; }
.lesson-meta-heading { margin-bottom: 13px; display: flex; align-items: baseline; gap: 12px; }
.lesson-meta-heading p { margin: 0; color: #8b5a12; font-size: 10px; }
.lesson-meta-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.lesson-meta-grid .lesson-meta-title-field { grid-column: span 2; }
.lesson-meta-grid .lesson-meta-tags-field { grid-column: span 2; }
.lesson-meta-grid output { min-height: 40px; border: 1px solid #e0e5ed; border-radius: 9px; padding: 9px 10px; background: #f8f9fb; color: #455066; overflow-wrap: anywhere; }
.lesson-meta-grid :disabled { background: #f4f5f7; color: #7b8493; cursor: not-allowed; }
.lesson-meta-view dl { margin: 13px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 18px; }
.lesson-meta-view dl > div { min-width: 0; }
.lesson-meta-view dt { margin-bottom: 4px; color: var(--muted); font-size: 10px; }
.lesson-meta-view dd { margin: 0; overflow-wrap: anywhere; font-size: 12px; }

.lesson-editor-grid { display: grid; grid-template-columns: 185px minmax(380px, 1fr) 265px; align-items: start; gap: 12px; }
.lesson-section-nav, .lesson-snapshot-panel { position: sticky; top: 62px; padding: 10px; }
.lesson-section-select { display: none; }
.lesson-section-nav ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 3px; }
.lesson-section-nav button { width: 100%; min-height: 40px; border: 0; border-radius: 8px; padding: 7px 8px; background: transparent; color: #526077; display: grid; grid-template-columns: 24px minmax(0, 1fr) 8px; align-items: center; gap: 7px; cursor: pointer; text-align: left; font-size: 11px; }
.lesson-section-nav button > span { width: 24px; height: 24px; border-radius: 50%; background: #f0f3f8; display: grid; place-items: center; color: #748096; font-size: 9px; }
.lesson-section-nav button[aria-current="location"] { background: var(--blue-soft); color: var(--blue); font-weight: 750; }
.lesson-section-nav button[aria-current="location"] > span { background: var(--blue); color: #fff; }
.lesson-section-nav button i { width: 7px; height: 7px; border: 1px solid #bfc7d4; border-radius: 50%; }
.lesson-section-nav button i.complete { border-color: #36a67a; background: #36a67a; }
.lesson-paper { min-width: 0; display: grid; gap: 10px; }
.lesson-edit-section, .lesson-view-section { scroll-margin-top: 80px; padding: 16px; }
.lesson-edit-section label { margin-bottom: 9px; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.lesson-edit-section label span, .lesson-view-section h2 { margin: 0; font-size: 14px; font-weight: 750; }
.lesson-edit-section label small { color: var(--muted); font-size: 9px; }
.lesson-edit-section textarea { width: 100%; min-height: 190px; resize: vertical; border: 1px solid #cbd5e2; border-radius: 10px; padding: 12px; background: #fff; color: var(--ink); font: inherit; font-size: 12px; line-height: 1.75; }
.lesson-view-section pre { min-height: 80px; margin: 11px 0 0; color: #354156; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 12px; line-height: 1.75; }
.lesson-snapshot-panel > header { margin-bottom: 10px; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.lesson-snapshot-panel h2 { margin: 0; font-size: 13px; }
.lesson-snapshot-panel header p { margin: 4px 0 0; color: var(--muted); font-size: 9px; line-height: 1.45; }
.lesson-snapshot-list { margin: 0; padding: 0; list-style: none; display: grid; }
.lesson-snapshot-list li { min-width: 0; border-top: 1px solid var(--line); padding: 9px 0; display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.lesson-snapshot-list li > div { min-width: 0; display: grid; gap: 3px; }
.lesson-snapshot-list strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.lesson-snapshot-list small { color: var(--muted); font-size: 8px; }
.lesson-snapshot-empty, .lesson-snapshot-error { padding: 12px 2px; color: var(--muted); font-size: 10px; text-align: center; }
.lesson-snapshot-empty p { margin: 0 0 9px; }
.lesson-restore-warning { border: 1px solid #f0d28e; border-radius: 10px; padding: 12px; background: #fff8e7; color: #77520b; font-size: 12px; line-height: 1.6; }

@media (max-width: 1180px) {
  .lesson-filters { grid-template-columns: repeat(3, minmax(130px, 1fr)); }
  .lesson-search-filter { grid-column: span 2; }
  .lesson-editor-grid { grid-template-columns: 175px minmax(0, 1fr); }
  .lesson-snapshot-panel { position: static; grid-column: 1 / -1; }
  .lesson-snapshot-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
}

@media (max-width: 760px) {
  .lesson-filters { grid-template-columns: 1fr; padding: 12px; }
  .lesson-search-filter { grid-column: auto; }
  .lesson-filters .button, .lesson-filters > .text-button { min-height: 44px; }
  .lesson-card { grid-template-columns: 36px minmax(0, 1fr); align-items: start; padding: 13px; gap: 10px; }
  .lesson-card-icon { width: 36px; height: 36px; }
  .lesson-card-title { align-items: flex-start; }
  .lesson-card-title h2 { white-space: normal; overflow-wrap: anywhere; }
  .lesson-open { grid-column: 1 / -1; width: 100%; min-height: 44px; }
  .lesson-save-cluster, .lesson-save-alert { align-items: stretch; flex-direction: column; }
  .lesson-save-cluster { position: static; }
  .lesson-save-alert > div { display: grid; grid-template-columns: 1fr; }
  .lesson-meta-grid, .lesson-meta-view dl { grid-template-columns: 1fr; }
  .lesson-meta-grid .lesson-meta-title-field, .lesson-meta-grid .lesson-meta-tags-field { grid-column: auto; }
  .lesson-editor-grid { grid-template-columns: 1fr; }
  .lesson-section-nav { position: static; padding: 12px; }
  .lesson-section-select { display: grid; gap: 5px; color: var(--muted); font-size: 10px; }
  .lesson-section-select select { min-height: 44px; border: 1px solid #cbd5e2; border-radius: 9px; padding: 8px 10px; background: #fff; color: var(--ink); }
  .lesson-section-nav ol { display: none; }
  .lesson-edit-section textarea { min-height: 220px; }
  .lesson-snapshot-list { grid-template-columns: 1fr; }
}

/* M6 · 论文项目、章节写作与引用 */
.paper-filters { margin-bottom: 16px; padding: 13px 14px; display: grid; grid-template-columns: minmax(260px, 1fr) minmax(150px, 220px) auto auto; align-items: end; gap: 10px; box-shadow: none; }
.paper-filters label, .paper-meta-grid label { min-width: 0; display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 650; }
.paper-filters input, .paper-filters select, .paper-meta-grid input, .paper-meta-grid select, .paper-meta-grid textarea { width: 100%; min-height: 40px; border: 1px solid #cbd5e2; border-radius: 9px; padding: 8px 10px; background: #fff; color: var(--ink); }
.paper-filters > .text-button { min-height: 40px; padding-inline: 8px; }
.paper-project-list { display: grid; gap: 10px; }
.paper-project-card { min-width: 0; min-height: 130px; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 14px; }
.paper-project-icon { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; }
.paper-project-icon .icon { width: 21px; }
.paper-project-copy { min-width: 0; display: grid; gap: 7px; }
.paper-project-title { min-width: 0; display: flex; align-items: center; gap: 8px; }
.paper-project-title h2 { min-width: 0; overflow: hidden; margin: 0; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.paper-project-copy > p { margin: 0; color: var(--muted); display: flex; flex-wrap: wrap; gap: 5px 12px; font-size: 10px; }
.paper-card-progress { display: grid; grid-template-columns: minmax(90px, 210px) auto; align-items: center; gap: 8px; }
.paper-card-progress small { color: var(--muted); font-size: 9px; }
.paper-progress-track, .paper-progress-line { overflow: hidden; border-radius: 99px; background: #e8edf5; }
.paper-progress-track { height: 5px; }
.paper-progress-track i, .paper-progress-line i { height: 100%; display: block; border-radius: inherit; background: linear-gradient(90deg, var(--blue), #6a8cf2); }
.paper-open .icon { width: 14px; }
.paper-load-more { justify-self: center; min-width: 150px; margin: 8px 0; }
.paper-state { min-height: 290px; display: grid; place-items: center; }
.paper-state > .empty-state > .button { margin-top: 12px; }

.paper-save-cluster, .paper-readonly-state { position: sticky; z-index: 7; top: 8px; min-height: 42px; margin: -4px 0 10px; border: 1px solid var(--line); border-radius: 11px; padding: 8px 12px; background: rgb(255 255 255 / 94%); box-shadow: 0 7px 24px rgb(24 40 72 / 8%); backdrop-filter: blur(8px); }
.paper-save-cluster { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.paper-save-status { color: #267255; font-size: 11px; font-weight: 750; }
.paper-save-status[data-state="pending"], .paper-save-status[data-state="saving"] { color: #315f9f; }
.paper-save-status[data-state="conflict"], .paper-save-status[data-state="error"] { color: var(--red); }
.paper-save-cluster kbd { border: 1px solid #d7dde7; border-radius: 5px; padding: 1px 4px; background: #f7f8fa; color: var(--muted); font: inherit; }
.paper-readonly-state { display: flex; align-items: center; color: var(--muted); font-size: 11px; }
.paper-save-alert { margin-bottom: 10px; border: 1px solid #efc7c5; border-radius: 11px; padding: 10px 12px; background: #fff5f4; color: #8a3732; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 11px; }
.paper-save-alert[hidden] { display: none; }
.paper-save-alert > div { flex: 0 0 auto; display: flex; gap: 7px; }

.paper-meta-editor, .paper-meta-view { margin-bottom: 10px; padding: 16px; }
.paper-meta-heading { margin-bottom: 13px; display: flex; align-items: baseline; gap: 12px; }
.paper-meta-heading h2, .paper-meta-view h2 { margin: 0; font-size: 14px; }
.paper-meta-heading p { margin: 0; color: var(--muted); font-size: 10px; }
.paper-meta-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.paper-meta-grid .paper-meta-title-field { grid-column: span 2; }
.paper-meta-grid .paper-meta-keywords-field { grid-column: span 2; }
.paper-meta-grid .paper-meta-abstract-field { grid-column: 1 / -1; }
.paper-meta-grid textarea { resize: vertical; font: inherit; line-height: 1.55; }
.paper-meta-view dl { margin: 13px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 18px; }
.paper-meta-view dl > div { min-width: 0; }
.paper-meta-view dt { margin-bottom: 4px; color: var(--muted); font-size: 10px; }
.paper-meta-view dd { margin: 0; overflow-wrap: anywhere; font-size: 12px; }
.paper-meta-view .paper-meta-wide { grid-column: 1 / -1; }
.paper-abstract-view { white-space: pre-wrap; line-height: 1.65; }

.paper-progress-card { min-height: 56px; margin-bottom: 12px; padding: 10px 14px; display: grid; grid-template-columns: auto minmax(120px, 1fr) 42px; align-items: center; gap: 14px; }
.paper-progress-card > div:first-child { display: grid; gap: 2px; }
.paper-progress-card strong { font-size: 14px; }
.paper-progress-card span { color: var(--muted); font-size: 9px; }
.paper-progress-line { height: 7px; }
.paper-progress-card b { color: var(--blue); font-size: 11px; text-align: right; }

.paper-editor-grid { display: grid; grid-template-columns: 220px minmax(400px, 1fr) 310px; align-items: start; gap: 12px; }
.paper-section-tree { position: sticky; top: 62px; padding: 10px; }
.paper-section-tree > header, .paper-reference-panel > header, .paper-snapshot-panel > header, .paper-share-panel > header { margin-bottom: 10px; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.paper-section-tree h2, .paper-reference-panel h2, .paper-snapshot-panel h2, .paper-share-panel h2 { margin: 0; font-size: 13px; }
.paper-section-tree header p, .paper-reference-panel header p, .paper-snapshot-panel header p, .paper-share-panel header p { margin: 4px 0 0; color: var(--muted); font-size: 9px; line-height: 1.45; }
.paper-reference-header-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 5px; }
.paper-reference-header-actions .text-button { min-height: 32px; padding: 4px 6px; }
.paper-section-select { display: none; }
.paper-section-tree ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 5px; }
.paper-section-tree li { min-width: 0; border: 1px solid transparent; border-radius: 9px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.paper-section-tree li.active { border-color: #d7e4fa; background: var(--blue-soft); }
.paper-section-link { min-width: 0; min-height: 45px; border: 0; padding: 7px 4px 7px 7px; background: transparent; color: #526077; display: grid; grid-template-columns: 24px minmax(0, 1fr); align-items: center; gap: 7px; cursor: pointer; text-align: left; }
.paper-section-link > span:first-child { width: 24px; height: 24px; border-radius: 50%; background: #f0f3f8; display: grid; place-items: center; color: #748096; font-size: 9px; }
.paper-section-tree li.active .paper-section-link { color: var(--blue); }
.paper-section-tree li.active .paper-section-link > span:first-child { background: var(--blue); color: #fff; }
.paper-section-link > span:last-child { min-width: 0; display: grid; gap: 2px; }
.paper-section-link strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.paper-section-link small { color: var(--muted); font-size: 8px; }
.paper-section-actions { padding-right: 3px; display: none; align-items: center; }
.paper-section-tree li:hover .paper-section-actions, .paper-section-tree li:focus-within .paper-section-actions { display: flex; }
.paper-section-actions button { width: 26px; height: 30px; border: 0; border-radius: 6px; padding: 5px; background: transparent; color: var(--muted); cursor: pointer; }
.paper-section-actions button:hover:not(:disabled) { background: #fff; color: var(--blue); }
.paper-section-actions button:disabled { opacity: .32; cursor: default; }
.paper-section-actions .icon { width: 12px; }
.paper-section-empty, .paper-reference-empty, .paper-snapshot-empty, .paper-snapshot-error { padding: 14px 3px; color: var(--muted); font-size: 10px; text-align: center; }
.paper-section-empty p, .paper-reference-empty p, .paper-snapshot-empty p, .paper-snapshot-error p { margin: 0 0 9px; }

.paper-writing-sheet { min-width: 0; padding: 20px; }
.paper-writing-sheet > header { margin-bottom: 12px; display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.paper-writing-sheet > header label { min-width: 0; flex: 1; display: grid; gap: 5px; color: var(--muted); font-size: 10px; }
.paper-writing-sheet > header input { width: 100%; min-height: 43px; border: 0; border-bottom: 1px solid var(--line); padding: 5px 1px; background: transparent; color: var(--ink); font-size: 18px; font-weight: 760; }
.paper-writing-sheet > header > strong { flex: 0 0 auto; color: var(--muted); font-size: 10px; }
.paper-writing-sheet > header > div > span { color: var(--muted); font-size: 9px; }
.paper-writing-sheet > header > div > h2 { margin: 3px 0 0; font-size: 18px; }
.paper-body-field { margin-bottom: 7px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.paper-body-field > span { font-size: 11px; font-weight: 700; }
.paper-body-field > small { color: var(--muted); font-size: 9px; }
.paper-writing-sheet > textarea { width: 100%; min-height: 600px; resize: vertical; border: 1px solid #cbd5e2; border-radius: 10px; padding: 15px; background: #fff; color: var(--ink); font: inherit; font-size: 13px; line-height: 1.9; }
.paper-readonly-content { min-height: 300px; border-top: 1px solid var(--line); padding-top: 16px; color: #354156; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.9; }

.paper-tools-column { min-width: 0; display: grid; gap: 12px; }
.paper-reference-panel, .paper-snapshot-panel, .paper-share-panel { padding: 11px; }
.paper-reference-list, .paper-snapshot-list { margin: 0; padding: 0; list-style: none; display: grid; }
.paper-reference-list > li, .paper-snapshot-list > li { min-width: 0; border-top: 1px solid var(--line); padding: 10px 0; display: grid; gap: 7px; }
.paper-reference-list > li:first-child, .paper-snapshot-list > li:first-child { border-top: 0; }
.paper-reference-list > li > div:first-child, .paper-snapshot-list li > div { min-width: 0; display: grid; gap: 4px; }
.paper-reference-list strong, .paper-snapshot-list strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.paper-reference-list p { margin: 0; color: #455066; font-size: 9px; line-height: 1.55; overflow-wrap: anywhere; }
.paper-reference-list small, .paper-snapshot-list small { color: var(--muted); font-size: 8px; }
.paper-reference-actions { display: flex; align-items: center; justify-content: flex-end; gap: 5px; }
.paper-reference-actions .icon-button { width: 30px; height: 30px; }
.paper-reference-actions .icon { width: 13px; }
.paper-reference-import-source { display: grid; grid-template-columns: minmax(0, .72fr) minmax(0, 1.28fr); gap: 14px; }
.paper-reference-import-report { min-width: 0; outline: none; }
.paper-reference-import-hero { border: 1px solid #cfe5dc; border-radius: 12px; padding: 13px 14px; background: #f4fbf8; display: flex; align-items: flex-start; gap: 10px; }
.paper-reference-import-hero > .icon { width: 22px; height: 22px; flex: 0 0 auto; color: var(--mint); }
.paper-reference-import-hero h3 { margin: 0; font-size: 15px; }
.paper-reference-import-hero p { margin: 4px 0 0; color: #526077; font-size: 11px; line-height: 1.55; }
.paper-reference-import-summary { margin: 12px 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; }
.paper-reference-import-summary > div { min-width: 0; border: 1px solid var(--line); border-radius: 9px; padding: 8px; background: #fafbfd; text-align: center; }
.paper-reference-import-summary dt { color: var(--muted); font-size: 9px; }
.paper-reference-import-summary dd { margin: 2px 0 0; font-size: 17px; font-weight: 800; }
.paper-reference-import-results { display: grid; gap: 8px; }
.paper-reference-import-details { border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
.paper-reference-import-details summary { min-height: 44px; padding: 8px 11px; display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; font-size: 11px; font-weight: 750; }
.paper-reference-import-details summary b { min-width: 24px; border-radius: 99px; padding: 3px 6px; background: #edf1f7; text-align: center; font-size: 9px; }
.paper-reference-import-details.paper-reference-import-mint summary { color: var(--mint); }
.paper-reference-import-details.paper-reference-import-amber summary { color: #80560a; }
.paper-reference-import-details.paper-reference-import-red summary { color: var(--red); }
.paper-reference-import-details.paper-reference-import-blue summary { color: var(--blue); }
.paper-reference-import-details ol { max-height: 250px; overflow: auto; margin: 0; padding: 0 11px; list-style: none; }
.paper-reference-import-details li { min-width: 0; border-top: 1px solid var(--line); padding: 9px 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 8px; }
.paper-reference-import-details li > div { min-width: 0; display: grid; gap: 3px; }
.paper-reference-import-details strong { overflow-wrap: anywhere; font-size: 10px; }
.paper-reference-import-details small { color: var(--muted); overflow-wrap: anywhere; font-size: 9px; line-height: 1.5; }
.paper-reference-import-details code { max-width: 230px; border-radius: 5px; padding: 3px 5px; background: #f0f3f8; color: #5a6780; overflow-wrap: anywhere; font-size: 8px; }
.paper-reference-import-done { margin-top: 14px; display: flex; justify-content: flex-end; }
.paper-snapshot-list > li { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.paper-citation-list { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.paper-citation-list h3 { margin: 0 0 6px; font-size: 10px; }
.paper-citation-list ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.paper-citation-list li { min-height: 34px; border-radius: 7px; padding: 4px 5px 4px 8px; background: #f7f9fc; display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 9px; }
.paper-citation-list .icon-button { width: 28px; height: 28px; }
.paper-citation-list .icon { width: 11px; }
.paper-warning { border: 1px solid #f0d28e; border-radius: 10px; padding: 12px; background: #fff8e7; color: #77520b; font-size: 12px; line-height: 1.6; }
.paper-share-panel > form { margin-bottom: 8px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.paper-share-panel > form input { width: 100%; min-height: 38px; border: 1px solid #cbd5e2; border-radius: 8px; padding: 7px 9px; color: var(--ink); }
.paper-share-list { margin: 0; padding: 0; list-style: none; display: grid; }
.paper-share-list li { min-width: 0; border-top: 1px solid var(--line); padding: 8px 0; display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.paper-share-list li > div { min-width: 0; display: grid; gap: 3px; }
.paper-share-list strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.paper-share-list small { color: var(--muted); font-size: 8px; }
.paper-share-empty, .paper-share-error { padding: 10px 2px; color: var(--muted); font-size: 10px; text-align: center; }
.paper-share-error p { margin: 0 0 7px; }

@media (max-width: 1260px) {
  .paper-editor-grid { grid-template-columns: 195px minmax(0, 1fr); }
  .paper-tools-column { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .paper-filters { grid-template-columns: minmax(200px, 1fr) minmax(150px, .5fr) auto; }
  .paper-filters > .text-button { grid-column: 3; }
  .paper-meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .paper-editor-grid { grid-template-columns: 175px minmax(0, 1fr); }
  .paper-writing-sheet { padding: 16px; }
  .paper-writing-sheet > textarea { min-height: 520px; }
}

@media (max-width: 760px) {
  .paper-filters { grid-template-columns: 1fr; padding: 12px; }
  .paper-filters > .text-button { grid-column: auto; }
  .paper-filters .button, .paper-filters > .text-button { min-height: 44px; }
  .paper-project-card { grid-template-columns: 38px minmax(0, 1fr); align-items: start; padding: 13px; gap: 10px; }
  .paper-project-icon { width: 38px; height: 38px; }
  .paper-project-title { align-items: flex-start; }
  .paper-project-title h2 { white-space: normal; overflow-wrap: anywhere; }
  .paper-card-progress { grid-template-columns: 1fr; }
  .paper-open { grid-column: 1 / -1; width: 100%; min-height: 44px; }
  .paper-save-cluster, .paper-save-alert { align-items: stretch; flex-direction: column; }
  .paper-save-cluster { position: static; }
  .paper-save-alert > div { display: grid; grid-template-columns: 1fr; }
  .paper-meta-grid, .paper-meta-view dl { grid-template-columns: 1fr; }
  .paper-meta-grid .paper-meta-title-field, .paper-meta-grid .paper-meta-keywords-field, .paper-meta-grid .paper-meta-abstract-field, .paper-meta-view .paper-meta-wide { grid-column: auto; }
  .paper-progress-card { grid-template-columns: minmax(0, 1fr) 42px; }
  .paper-progress-card > div:first-child { grid-column: 1 / -1; }
  .paper-editor-grid { grid-template-columns: 1fr; }
  .paper-section-tree { position: static; padding: 12px; }
  .paper-section-select { display: grid; gap: 5px; color: var(--muted); font-size: 10px; }
  .paper-section-select select { min-height: 44px; border: 1px solid #cbd5e2; border-radius: 9px; padding: 8px 10px; background: #fff; color: var(--ink); }
  .paper-section-tree ol { display: none; }
  .paper-writing-sheet { padding: 13px; }
  .paper-writing-sheet > header { align-items: stretch; flex-direction: column; }
  .paper-body-field { align-items: flex-start; flex-direction: column; }
  .paper-writing-sheet > textarea { min-height: 420px; padding: 12px; font-size: 12px; }
  .paper-tools-column { grid-column: auto; grid-template-columns: 1fr; }
  .paper-reference-header-actions .text-button { min-height: 44px; }
  .paper-reference-actions .text-button { min-height: 44px; }
  .paper-reference-actions .icon-button, .paper-citation-list .icon-button { width: 44px; height: 44px; }
  .paper-reference-import-source { grid-template-columns: 1fr; gap: 8px; }
  .paper-reference-import-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .paper-reference-import-summary > div:last-child { grid-column: 1 / -1; }
  .paper-reference-import-details li { grid-template-columns: 1fr; }
  .paper-reference-import-details code { max-width: 100%; justify-self: start; }
  .paper-reference-import-done .button { width: 100%; min-height: 44px; }
  .paper-share-panel > form { grid-template-columns: 1fr; }
  .paper-share-panel > form .button { min-height: 44px; }
}

/* M7 · 成绩统计与分析 */
.grade-filters { min-width: 0; margin-bottom: 14px; padding: 14px; display: grid; grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(130px, .7fr)); gap: 10px; align-items: end; }
.grade-filters label { min-width: 0; display: grid; gap: 5px; color: var(--muted); font-size: 10px; font-weight: 700; }
.grade-filters input, .grade-filters select { width: 100%; min-height: 40px; border: 1px solid #cbd5e2; border-radius: 9px; padding: 8px 10px; background: #fff; color: var(--ink); font: inherit; }
.grade-filters .search-box { display: flex; }
.grade-filters .search-box input { min-height: 36px; border: 0; padding: 0; }
.grade-filters .grade-search { grid-column: span 2; }
.grade-filter-actions { display: flex; align-items: center; gap: 8px; }

.grade-state { min-width: 0; padding: 24px; }
.grade-state > .button { display: flex; margin: 14px auto 0; }
.grade-assessment-list { min-width: 0; display: grid; gap: 10px; }
.grade-list-limit-note { margin: 2px 0 0; color: var(--muted); font-size: 9px; text-align: center; }
.grade-assessment-card { min-width: 0; padding: 15px; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 13px; }
.grade-assessment-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; }
.grade-assessment-icon .icon { width: 20px; }
.grade-assessment-copy { min-width: 0; display: grid; gap: 6px; }
.grade-assessment-copy > div { min-width: 0; display: flex; align-items: center; gap: 8px; }
.grade-assessment-copy h2 { min-width: 0; margin: 0; overflow: hidden; color: var(--ink); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.grade-assessment-copy p, .grade-assessment-copy small { margin: 0; color: var(--muted); font-size: 10px; }
.grade-assessment-card > .button .icon { width: 12px; }

.grade-access-note { margin-bottom: 10px; border: 1px solid #cbd8eb; border-radius: 10px; padding: 10px 12px; background: #f5f8fd; color: #536178; font-size: 10px; }
.grade-metadata { min-width: 0; margin-bottom: 12px; padding: 15px; }
.grade-metadata > header, .grade-items > header, .grade-matrix > header, .grade-distribution > header, .grade-item-statistics > header, .grade-student-composites > header, .grade-trends > header, .grade-comparison > header { margin-bottom: 13px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.grade-metadata h2, .grade-items h2, .grade-matrix h2, .grade-distribution h2, .grade-item-statistics h2, .grade-student-composites h2, .grade-trends h2, .grade-comparison h2 { margin: 0; font-size: 13px; }
.grade-metadata header p, .grade-items header p, .grade-matrix header p, .grade-distribution header p, .grade-item-statistics header p, .grade-student-composites header p, .grade-trends header p, .grade-comparison header p { margin: 3px 0 0; color: var(--muted); font-size: 9px; }
.grade-metadata dl { margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.grade-metadata dl > div { min-width: 0; border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; background: #f8fafc; display: grid; gap: 4px; }
.grade-metadata dt { color: var(--muted); font-size: 9px; }
.grade-metadata dd { margin: 0; color: var(--ink); font-size: 11px; font-weight: 700; overflow-wrap: anywhere; }
.grade-metadata .grade-meta-wide { grid-column: span 2; }
.grade-form-warning { margin-bottom: 10px; border: 1px solid #f0d28e; border-radius: 9px; padding: 9px; background: #fff8e7; color: #77520b; font-size: 10px; }

.grade-items { min-width: 0; padding: 15px; }
.grade-weight-summary { margin-bottom: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 4px 10px; }
.grade-weight-summary strong { font-size: 18px; }
.grade-weight-summary span { color: var(--muted); font-size: 10px; }
.grade-weight-summary > div { grid-column: 1 / -1; height: 6px; overflow: hidden; border-radius: 10px; background: #e8edf5; }
.grade-weight-summary i { display: block; height: 100%; border-radius: inherit; background: #6189ee; }
.grade-weight-summary.ready { border-color: #a9dec8; background: #f2fbf7; }
.grade-weight-summary.ready i { background: #42a978; }
.grade-weight-summary.over { border-color: #efb6b6; background: #fff5f5; }
.grade-weight-summary.over i { background: #d96767; }
.grade-items-table-wrap, .grade-distribution-table-wrap, .grade-item-statistics > div, .grade-student-composites > div, .grade-trend-table-wrap, .grade-comparison-overall, .grade-comparison-students { max-width: 100%; overflow: auto; }
.grade-items table, .grade-distribution table, .grade-item-statistics table, .grade-student-composites table, .grade-trends table, .grade-comparison table { width: 100%; border-collapse: collapse; font-size: 10px; }
.grade-items th, .grade-items td, .grade-distribution th, .grade-distribution td, .grade-item-statistics th, .grade-item-statistics td, .grade-student-composites th, .grade-student-composites td, .grade-trends th, .grade-trends td, .grade-comparison th, .grade-comparison td { border-bottom: 1px solid var(--line); padding: 9px; text-align: left; vertical-align: top; }
.grade-items thead th, .grade-distribution thead th, .grade-item-statistics thead th, .grade-student-composites thead th, .grade-trends thead th, .grade-comparison thead th { color: var(--muted); font-size: 9px; white-space: nowrap; }
.grade-row-actions { display: flex; gap: 4px; }
.grade-row-actions .icon-button { width: 32px; height: 32px; }
.grade-row-actions .icon { width: 13px; }
.grade-empty-inline .empty-state { padding: 18px; }
.grade-draft-actions { margin-top: 14px; display: flex; justify-content: flex-end; gap: 8px; }

.grade-matrix { min-width: 0; padding: 14px; }
.grade-matrix-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.grade-matrix-actions > span, .grade-readonly-chip { color: var(--muted); font-size: 9px; }
.grade-readonly-chip { border-radius: 20px; padding: 6px 9px; background: #eef2f8; }
.grade-keyboard-hint { margin: -3px 0 10px; color: var(--muted); font-size: 9px; }
.grade-matrix-notice { margin-bottom: 10px; border: 1px solid #efcf88; border-radius: 9px; padding: 9px 10px; background: #fff8e8; color: #77520b; display: flex; align-items: center; gap: 7px; font-size: 10px; }
.grade-matrix-notice .icon { width: 15px; flex: 0 0 auto; }
.grade-matrix-notice.is-conflict { border-color: #e8b5b5; background: #fff4f4; color: #923d3d; }
.grade-matrix-scroll { max-width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: 10px; overscroll-behavior-inline: contain; }
.grade-matrix-table { min-width: max-content; border-collapse: separate; border-spacing: 0; font-size: 10px; }
.grade-matrix-table th, .grade-matrix-table td { min-width: 142px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 8px; background: #fff; text-align: left; vertical-align: top; }
.grade-matrix-table thead th { position: sticky; top: 0; z-index: 2; background: #f5f8fc; }
.grade-matrix-table thead th > strong, .grade-matrix-table thead th > small, .grade-matrix-table tbody th > strong, .grade-matrix-table tbody th > small { display: block; }
.grade-matrix-table th > small { margin-top: 3px; color: var(--muted); font-size: 8px; font-weight: 500; }
.grade-matrix-table .grade-student-column { position: sticky; left: 0; z-index: 1; min-width: 155px; max-width: 180px; }
.grade-matrix-table thead .grade-student-column { z-index: 3; }
.grade-matrix-table .grade-total-column { min-width: 130px; background: #f8fbff; }
.grade-score-cell { width: 126px; display: grid; gap: 5px; }
.grade-score-cell select, .grade-score-cell input { width: 100%; min-height: 34px; border: 1px solid #cbd5e2; border-radius: 7px; padding: 5px 7px; background: #fff; color: var(--ink); font: inherit; }
.grade-score-cell input:disabled { background: #f1f4f8; color: var(--muted); }
.grade-cell-state { display: inline-flex; border-radius: 20px; padding: 5px 7px; background: #f0f3f8; color: #59667a; font-size: 9px; }
.grade-cell-state.status-absent { background: #fff2df; color: #91601f; }
.grade-cell-state.status-exempt { background: #eef0f5; color: #697286; }
.grade-blocked-total { color: #8a5560; font-size: 9px; }
.grade-blocked-total small { display: block; max-width: 140px; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.grade-pagination { margin-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 9px; }
.grade-pagination > div { display: flex; align-items: center; gap: 8px; }
.grade-pagination strong { color: var(--ink); }
.grade-import-summary { margin: 0; padding: 12px 14px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; background: #fbfcfe; border-top: 1px solid var(--line); }
.grade-import-summary > div { min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: #fff; display: grid; gap: 3px; }
.grade-import-summary dt { color: var(--muted); font-size: 9px; }
.grade-import-summary dd { margin: 0; color: var(--ink); font-size: 14px; font-weight: 750; }
.grade-import-limit-note { margin: 0; padding: 8px 10px; border-top: 1px solid var(--line); background: #f8fafc; color: var(--muted); font-size: 9px; }

.grade-stat-grid { margin-bottom: 12px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.grade-distribution, .grade-item-statistics, .grade-student-composites, .grade-trends, .grade-comparison { min-width: 0; margin-bottom: 12px; padding: 14px; }
.grade-distribution figure { margin: 0 0 12px; }
.grade-distribution-bars { display: grid; gap: 8px; }
.grade-distribution-bars > div { display: grid; grid-template-columns: minmax(65px, 110px) minmax(100px, 1fr) 52px; align-items: center; gap: 8px; font-size: 9px; }
.grade-distribution-bars i { height: 12px; overflow: hidden; border-radius: 8px; background: #e8edf5; }
.grade-distribution-bars b { display: block; min-width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #4d7bea, #79a1ff); }
.grade-distribution-bars strong { text-align: right; }
.grade-item-statistics > div, .grade-student-composites > div { border: 1px solid var(--line); border-radius: 9px; }
.grade-item-statistics table, .grade-student-composites table { min-width: 720px; }
.grade-student-composites td ul { margin: 0; padding-left: 16px; color: #8a5560; }
.grade-trend-chart { max-width: 100%; height: 215px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 8px; overflow-x: auto; display: flex; align-items: stretch; gap: 4px; background: linear-gradient(to top, #e8edf5 1px, transparent 1px) 0 0 / 100% 25%; overscroll-behavior-inline: contain; }
.grade-trend-chart > div { min-width: 56px; flex: 1 0 56px; display: grid; grid-template-rows: 18px minmax(120px, 1fr) 18px; justify-items: center; gap: 3px; color: var(--muted); font-size: 8px; }
.grade-trend-chart > div > span, .grade-trend-chart > div > strong { align-self: center; font-size: 8px; white-space: nowrap; }
.grade-trend-chart > div > strong { color: var(--ink); }
.grade-trend-chart > div > i { width: 100%; min-height: 0; position: relative; border-bottom: 1px solid #b7c2d2; display: flex; align-items: flex-end; justify-content: center; font-style: normal; }
.grade-trend-chart > div > i > b { width: 14px; min-height: 1px; position: relative; border-radius: 6px 6px 1px 1px; background: linear-gradient(180deg, #79a1ff, #4d7bea); }
.grade-trend-chart > div > i > b::after { width: 7px; height: 7px; content: ''; position: absolute; top: -3px; left: 50%; border: 2px solid #fff; border-radius: 50%; background: #2f66de; box-shadow: 0 0 0 1px #2f66de; transform: translateX(-50%); }
.grade-trend-chart > div > i > small { margin: auto; color: var(--muted); font-size: 8px; }
.grade-trend-chart > div.is-current { border-radius: 7px; background: rgb(77 123 234 / 8%); }
.grade-trend-chart > div.is-current > strong { color: #245ac8; }
.grade-trend-table-wrap, .grade-comparison-overall, .grade-comparison-students { border: 1px solid var(--line); border-radius: 9px; overscroll-behavior-inline: contain; }
.grade-trends table, .grade-comparison table { min-width: 720px; }
.grade-trends tbody tr.is-current { background: #f2f6ff; }
.grade-comparison-select { width: min(290px, 100%); flex: 0 1 290px; }
.grade-comparison-select select { width: 100%; min-height: 38px; }
.grade-comparison-summary { margin-bottom: 12px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.grade-comparison-overall { margin-bottom: 12px; }
.grade-analytics-error { border: 1px solid #e8b5b5; border-radius: 9px; padding: 10px; background: #fff4f4; color: #923d3d; display: flex; align-items: center; gap: 8px; font-size: 10px; }
.grade-analytics-error .icon { width: 15px; flex: 0 0 auto; }
.grade-analytics-error span { min-width: 0; flex: 1; }
.grade-direction { display: inline-flex; border-radius: 20px; padding: 4px 7px; background: #eef2f8; color: #59667a; font-size: 9px; white-space: nowrap; }
.grade-direction.direction-improved { background: #e9f8f1; color: #287c59; }
.grade-direction.direction-declined { background: #fff0f0; color: #9a4141; }
.grade-direction.direction-unchanged { background: #fff7e8; color: #8b641f; }

@media (max-width: 1100px) {
  .grade-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grade-filters .grade-search { grid-column: span 2; }
  .grade-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grade-comparison-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .grade-filters { grid-template-columns: 1fr; padding: 12px; }
  .grade-filters .grade-search { grid-column: auto; }
  .grade-filter-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .grade-filter-actions .button, .grade-filter-actions .text-button { min-height: 44px; }
  .grade-assessment-card { grid-template-columns: 38px minmax(0, 1fr); align-items: start; padding: 12px; gap: 10px; }
  .grade-assessment-icon { width: 38px; height: 38px; }
  .grade-assessment-copy > div { align-items: flex-start; flex-direction: column; }
  .grade-assessment-copy h2 { white-space: normal; overflow-wrap: anywhere; }
  .grade-assessment-card > .button { grid-column: 1 / -1; width: 100%; min-height: 44px; }
  .grade-metadata > header, .grade-items > header, .grade-matrix > header, .grade-distribution > header, .grade-item-statistics > header, .grade-student-composites > header, .grade-trends > header, .grade-comparison > header { align-items: stretch; flex-direction: column; }
  .grade-metadata dl { grid-template-columns: 1fr 1fr; }
  .grade-metadata .grade-meta-wide { grid-column: 1 / -1; }
  .grade-draft-actions, .grade-matrix-actions { display: grid; grid-template-columns: 1fr; }
  .grade-draft-actions .button, .grade-matrix-actions .button { width: 100%; min-height: 44px; }
  .grade-matrix-actions > span { text-align: center; }
  .grade-import-summary { grid-template-columns: 1fr 1fr; }
  .grade-stat-grid { grid-template-columns: 1fr; }
  .grade-comparison-summary { grid-template-columns: 1fr; }
  .grade-comparison-select { width: 100%; flex-basis: auto; }
  .grade-trend-chart { height: 190px; }
  .grade-distribution-bars > div { grid-template-columns: 62px minmax(80px, 1fr) 42px; }
  .grade-pagination { align-items: stretch; flex-direction: column; }
  .grade-pagination > div { display: grid; grid-template-columns: 1fr auto 1fr; }
  .grade-pagination .button { min-height: 40px; }
}

@media (max-width: 430px) {
  .grade-metadata dl { grid-template-columns: 1fr; }
  .grade-metadata .grade-meta-wide { grid-column: auto; }
  .grade-weight-summary { grid-template-columns: 1fr; }
  .grade-weight-summary > div { grid-column: auto; }
}

@media (max-width: 768px), (pointer: coarse) {
  .button, .button.small, .text-button { min-height: 44px; }
  .icon-button, .grade-row-actions .icon-button, .paper-reference-actions .icon-button, .paper-citation-list .icon-button {
    min-width: 44px;
    width: 44px;
    height: 44px;
  }
  .grade-filters input, .grade-filters select, .grade-filters .search-box input,
  .grade-score-cell select, .grade-score-cell input, .grade-comparison-select select,
  .paper-filters input, .paper-filters select, .paper-meta-grid input,
  .paper-meta-grid select, .paper-meta-grid textarea, .paper-writing-sheet > header input,
  .paper-section-select select, .paper-share-panel > form input { min-height: 44px; }
  .grade-pagination .button { min-height: 44px; }
  .paper-section-actions button { min-width: 44px; width: 44px; height: 44px; }
}

/* M8 global search */
.global-search-form { margin-bottom: 18px; display: grid; gap: 15px; }
.global-search-query-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: stretch; }
.global-search-query, .global-search-input { min-width: 0; display: flex; }
.global-search-input { position: relative; align-items: center; }
.global-search-input > .icon { position: absolute; z-index: 1; left: 14px; width: 19px; color: #8290a6; pointer-events: none; }
.global-search-input input { min-height: 48px; padding: 11px 14px 11px 43px; font-size: 15px; }
.global-search-query-row > .button { min-width: 104px; min-height: 48px; }
.global-search-types { min-width: 0; margin: 0; border: 0; padding: 0; }
.global-search-types legend { margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 700; }
.global-search-types > div { display: flex; flex-wrap: wrap; gap: 8px; }
.global-search-types label { position: relative; cursor: pointer; }
.global-search-types input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.global-search-types label > span { min-height: 36px; border: 1px solid var(--line); border-radius: 999px; padding: 0 12px; background: #fff; color: #59667a; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; transition: .15s ease; }
.global-search-types label > span .icon { width: 15px; height: 15px; }
.global-search-types input:checked + span { border-color: #b9cbee; background: var(--blue-soft); color: var(--blue); }
.global-search-types input:focus-visible + span { outline: 3px solid rgb(31 99 216 / 72%); outline-offset: 2px; }
.global-search-state { min-height: 250px; display: grid; place-items: center; }
.global-search-state .empty-state .button { margin-top: 14px; }
.global-search-results { display: grid; gap: 12px; }
.global-search-results-summary { padding: 2px 2px 4px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.global-search-results-summary h2 { margin: 0; font-size: 16px; }
.global-search-results-summary p { margin: 0; color: var(--muted); font-size: 11px; text-align: right; }
.global-search-group { min-width: 0; padding: 0; overflow: hidden; }
.global-search-group > header { min-height: 62px; border-bottom: 1px solid var(--line); padding: 12px 16px; display: flex; align-items: center; gap: 10px; }
.global-search-group > header > span { width: 35px; height: 35px; border-radius: 10px; display: grid; place-items: center; }
.global-search-group > header > span .icon { width: 17px; height: 17px; }
.global-search-group > header h3, .global-search-group > header p { margin: 0; }
.global-search-group > header h3 { font-size: 14px; }
.global-search-group > header p { margin-top: 3px; color: var(--muted); font-size: 10px; }
.global-search-group ul { margin: 0; padding: 0; list-style: none; }
.global-search-group li + li { border-top: 1px solid var(--line); }
.global-search-result { min-width: 0; min-height: 76px; padding: 12px 16px; color: inherit; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 11px; text-decoration: none; transition: .15s ease; }
.global-search-result:hover { background: #f8faff; }
.global-search-result-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; }
.global-search-result-icon .icon { width: 18px; height: 18px; }
.global-search-result-copy { min-width: 0; display: grid; gap: 4px; }
.global-search-result-copy > strong, .global-search-result-copy > small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.global-search-result-copy > strong { font-size: 13px; }
.global-search-result-copy > small { color: var(--muted); font-size: 11px; line-height: 1.5; }
.global-search-result-copy > span { min-height: 16px; color: #79869a; display: flex; align-items: center; gap: 7px; font-size: 10px; }
.global-search-result-copy > span i { width: 3px; height: 3px; border-radius: 50%; background: #b7c0ce; }
.global-search-result-copy > span em { font-style: normal; }
.global-search-open { color: var(--blue); display: inline-flex; align-items: center; gap: 2px; font-size: 11px; font-weight: 650; }
.global-search-open .icon { width: 14px; height: 14px; }

@media (max-width: 1100px) {
  .top-search-button { width: 36px; padding: 0; justify-content: center; }
  .top-search-button > span { display: none; }
}

@media (max-width: 640px) {
  .top-search-button { width: 44px; height: 44px; margin-left: auto; }
  .top-clock { margin-left: 5px; }
  .global-search-query-row { grid-template-columns: 1fr; }
  .global-search-query-row > .button { width: 100%; min-height: 44px; }
  .global-search-input input { min-height: 48px; }
  .global-search-types > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .global-search-types label > span { width: 100%; min-height: 44px; justify-content: center; }
  .global-search-results-summary { align-items: flex-start; flex-direction: column; gap: 4px; }
  .global-search-results-summary p { text-align: left; line-height: 1.5; }
  .global-search-result { grid-template-columns: 38px minmax(0, 1fr); padding: 12px; }
  .global-search-result-icon { width: 38px; height: 38px; }
  .global-search-result-copy > strong, .global-search-result-copy > small { white-space: normal; overflow-wrap: anywhere; }
  .global-search-open { display: none; }
}

@media (max-width: 520px) {
  .top-clock { display: none; }
}

@media (max-width: 390px) {
  .global-search-types > div { grid-template-columns: 1fr; }
}

/* M8 knowledge points */
.knowledge-filters { min-width: 0; margin-bottom: 16px; padding: 13px 14px; display: grid; grid-template-columns: minmax(145px, .75fr) minmax(230px, 1.4fr) minmax(145px, .8fr) minmax(135px, .7fr) auto; align-items: end; gap: 10px; box-shadow: none; }
.knowledge-filters label { min-width: 0; display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 650; }
.knowledge-filters input, .knowledge-filters select { width: 100%; min-height: 38px; border: 1px solid #cbd5e2; border-radius: 9px; padding: 7px 9px; background: #fff; color: var(--ink); }
.knowledge-query-filter .search-box { min-width: 0; }
.knowledge-query-filter .search-box input { min-height: 38px; padding-left: 35px; }
.knowledge-state { min-height: 290px; display: grid; place-items: center; }
.knowledge-state .empty-state { max-width: 520px; }
.knowledge-empty-create { margin: -34px auto 28px; }
.knowledge-groups { min-width: 0; display: grid; gap: 17px; }
.knowledge-unit-group { min-width: 0; display: grid; gap: 9px; }
.knowledge-unit-group > header { min-width: 0; padding: 0 3px; }
.knowledge-unit-group > header > div { min-width: 0; display: flex; align-items: center; gap: 9px; }
.knowledge-unit-group > header > div > span { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 10px; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; }
.knowledge-unit-group > header .icon { width: 17px; }
.knowledge-unit-group > header h2, .knowledge-unit-group > header p { margin: 0; }
.knowledge-unit-group > header h2 { overflow-wrap: anywhere; font-size: 14px; }
.knowledge-unit-group > header p { margin-top: 2px; color: var(--muted); font-size: 10px; }
.knowledge-unit-group > div { min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.knowledge-card { min-width: 0; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: start; gap: 12px; }
.knowledge-card-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; }
.knowledge-card-icon .icon { width: 20px; }
.knowledge-card-copy { min-width: 0; display: grid; gap: 8px; }
.knowledge-card-heading { min-width: 0; }
.knowledge-card-heading h3 { margin: 0 0 6px; overflow-wrap: anywhere; font-size: 14px; }
.knowledge-card-heading > div > div { display: flex; flex-wrap: wrap; gap: 5px; }
.knowledge-card-copy > p { min-height: 34px; margin: 0; color: var(--muted); display: -webkit-box; overflow: hidden; font-size: 11px; line-height: 1.55; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.knowledge-assignment-link { width: fit-content; max-width: 100%; color: var(--blue); display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 650; text-decoration: none; }
.knowledge-assignment-link .icon { width: 14px; flex: 0 0 auto; }
.knowledge-card-actions { display: flex; align-items: center; gap: 5px; }
.knowledge-load-more { justify-self: center; min-width: 180px; margin: 4px 0 10px; }
.assignment-knowledge-field { margin: 1px 0 16px; display: grid; gap: 7px; }
.assignment-knowledge-field > header { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.assignment-knowledge-field > header > span { color: var(--ink); font-size: 12px; font-weight: 650; }
.assignment-knowledge-field > header > span b { color: var(--red); }
.assignment-knowledge-field > header > small { color: var(--muted); font-size: 10px; }
.assignment-knowledge-options { max-height: 210px; border: 1px solid var(--line); border-radius: 10px; padding: 8px; overflow: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.assignment-knowledge-options label { min-width: 0; min-height: 40px; border: 1px solid transparent; border-radius: 8px; padding: 7px 8px; background: #f8fafc; cursor: pointer; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 7px; }
.assignment-knowledge-options label:has(input:checked) { border-color: #b9cbee; background: var(--blue-soft); }
.assignment-knowledge-options input { width: 17px; height: 17px; accent-color: var(--blue); }
.assignment-knowledge-options span { min-width: 0; display: grid; gap: 2px; }
.assignment-knowledge-options strong, .assignment-knowledge-options small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assignment-knowledge-options strong { font-size: 11px; }
.assignment-knowledge-options small { color: var(--muted); font-size: 9px; }
.assignment-knowledge-state { min-height: 76px; border: 1px dashed #c9d2df; border-radius: 10px; padding: 12px; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 9px; text-align: center; font-size: 11px; }
.assignment-knowledge-state .button { flex: 0 0 auto; }
.homework-knowledge-badges { display: flex; flex-wrap: wrap; gap: 5px; }
.homework-knowledge-empty { color: var(--muted); display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 11px; }
.homework-knowledge-empty a { color: var(--blue); font-weight: 650; text-decoration: none; }
.homework-offering-guide { margin: -5px 0 14px; border: 1px solid #f1d49b; border-radius: 9px; padding: 8px 10px; background: #fff9ec; color: #6f5015; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 11px; }
.homework-offering-guide[hidden] { display: none; }
.homework-offering-guide .text-button { flex: 0 0 auto; color: #8a5a00; font-weight: 700; }

@media (max-width: 1080px) {
  .knowledge-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .knowledge-filters .button { justify-self: start; }
  .knowledge-unit-group > div { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .knowledge-filters { grid-template-columns: 1fr; padding: 12px; }
  .knowledge-filters .button { width: 100%; min-height: 44px; }
  .knowledge-card { grid-template-columns: 36px minmax(0, 1fr); padding: 13px; gap: 9px; }
  .knowledge-card-icon { width: 36px; height: 36px; }
  .knowledge-card-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .knowledge-card-actions .button { min-height: 44px; flex: 1; }
  .knowledge-card-actions .icon-button { width: 44px; height: 44px; }
  .assignment-knowledge-options { grid-template-columns: 1fr; max-height: 260px; }
  .assignment-knowledge-field > header { align-items: flex-start; flex-direction: column; gap: 3px; }
  .assignment-knowledge-state { align-items: stretch; flex-direction: column; }
  .assignment-knowledge-state .button { width: 100%; min-height: 40px; }
}

/* Shared detail attachments */
.attachment-panel { min-width: 0; display: grid; gap: 11px; }
.attachment-header { min-width: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.attachment-header > div { min-width: 0; }
.attachment-header h3, .attachment-header p { margin: 0; }
.attachment-header h3 { font-size: 14px; }
.attachment-header p { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.attachment-header > span { flex: 0 0 auto; border-radius: 999px; padding: 4px 8px; background: #eef2f8; color: #68758a; font-size: 9px; font-weight: 700; }
.attachment-upload { min-width: 0; border: 1px dashed #c8d2df; border-radius: 10px; padding: 9px; background: #fafcff; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 9px; }
.attachment-picker { position: relative; min-width: 0; cursor: pointer; }
.attachment-picker > .button { pointer-events: none; }
.attachment-picker input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.attachment-picker:focus-within > .button { outline: 3px solid rgb(31 99 216 / 72%); outline-offset: 2px; }
.attachment-selection { min-width: 0; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.attachment-selection.is-error, .attachment-inline-error { color: #983d49; }
.attachment-live-status { min-height: 16px; color: var(--muted); font-size: 10px; }
.attachment-inline-error { border: 1px solid #edc2c7; border-radius: 8px; padding: 8px 10px; background: #fff4f5; font-size: 10px; overflow-wrap: anywhere; }
.attachment-state { min-height: 76px; border: 1px solid var(--line); border-radius: 10px; padding: 14px; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 10px; text-align: center; font-size: 11px; }
.attachment-state-error { border-color: #edc2c7; background: #fffafa; color: #983d49; }
.attachment-list { min-width: 0; margin: 0; border: 1px solid var(--line); border-radius: 10px; padding: 0; overflow: hidden; list-style: none; }
.attachment-item { min-width: 0; padding: 10px 11px; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.attachment-item + .attachment-item { border-top: 1px solid var(--line); }
.attachment-file-icon { width: 36px; height: 36px; border-radius: 9px; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; }
.attachment-file-icon .icon { width: 17px; height: 17px; }
.attachment-file-copy { min-width: 0; display: grid; gap: 3px; }
.attachment-file-copy strong { min-width: 0; overflow-wrap: anywhere; font-size: 11px; line-height: 1.45; }
.attachment-file-copy small { color: var(--muted); font-size: 9px; line-height: 1.4; }
.attachment-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 5px; }

@media (max-width: 560px) {
  .attachment-upload { grid-template-columns: 1fr; }
  .attachment-picker, .attachment-picker > .button, .attachment-upload > .button { width: 100%; min-height: 44px; }
  .attachment-selection { white-space: normal; overflow-wrap: anywhere; }
  .attachment-item { grid-template-columns: 34px minmax(0, 1fr); padding: 10px; }
  .attachment-file-icon { width: 34px; height: 34px; }
  .attachment-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .attachment-actions .button { min-height: 44px; flex: 1; }
  .attachment-actions .icon-button { width: 44px; height: 44px; }
  .attachment-state .button { min-height: 44px; }
}

/* Settings and workspace members */
.sidebar-footer button.active { color: #fff; }
.teaching-setup-existing { margin-bottom: 16px; border: 1px solid #c9daf8; border-radius: 11px; padding: 12px 13px; background: var(--blue-soft); display: grid; gap: 8px; }
.teaching-setup-existing.is-empty { color: #36547c; }
.teaching-setup-existing > strong { color: var(--ink); font-size: 12px; }
.teaching-setup-existing > span { font-size: 11px; line-height: 1.6; }
.teaching-setup-existing > div { display: flex; flex-wrap: wrap; gap: 6px; }
.teaching-setup-fields { margin: -4px 0 16px; border: 1px dashed #cbd5e2; border-radius: 11px; padding: 14px; background: #f8fafc; }
.teaching-setup-fields[hidden] { display: none; }
.teaching-setup-check { min-height: 40px; display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-size: 12px; cursor: pointer; }
.teaching-setup-check input { width: 18px; height: 18px; accent-color: var(--blue); }
.settings-member-list { min-width: 0; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 12px; list-style: none; }
.settings-member-item { min-width: 0; }
.settings-member-card { min-width: 0; display: grid; gap: 14px; }
.settings-member-card.is-disabled { background: #fafbfc; }
.settings-member-header { min-width: 0; align-items: flex-start; gap: 12px; }
.settings-member-identity { min-width: 0; display: grid; grid-template-columns: 42px minmax(0, 1fr); align-items: center; gap: 10px; }
.settings-member-identity > span { width: 42px; height: 42px; border-radius: 12px; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; font-weight: 800; }
.settings-member-identity > div { min-width: 0; }
.settings-member-identity h2, .settings-member-identity p { margin: 0; }
.settings-member-identity h2 { overflow-wrap: anywhere; font-size: 14px; }
.settings-member-identity p { margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.settings-member-badges { flex: 0 0 auto; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.settings-member-details { min-width: 0; margin: 0; display: grid; gap: 9px; }
.settings-member-details > div { min-width: 0; border-top: 1px solid var(--line); padding-top: 9px; display: grid; grid-template-columns: 82px minmax(0, 1fr); align-items: start; gap: 9px; }
.settings-member-details dt { color: var(--muted); font-size: 10px; font-weight: 650; }
.settings-member-details dd { min-width: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 5px; overflow-wrap: anywhere; font-size: 11px; }
.settings-member-actions { width: 100%; margin-top: 0; padding-top: 0; justify-self: stretch; display: flex; flex-wrap: wrap; gap: 7px; }
.settings-member-actions .button { min-height: 40px; }
.settings-member-state { min-height: 280px; display: grid; place-items: center; }
.settings-member-state .inline-error { max-width: 560px; }
.settings-access-note { min-height: 300px; display: grid; place-items: center; }
.settings-access-note .empty-state { max-width: 560px; }
.settings-class-fieldset, .settings-permission-options { min-width: 0; margin: 0 0 16px; border: 0; padding: 0; }
.settings-class-fieldset > legend, .settings-permission-options > legend { margin-bottom: 7px; color: var(--ink); font-size: 12px; font-weight: 650; }
.settings-class-options { max-height: 250px; }
.settings-permission-options { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.settings-permission-options > label { min-height: 40px; border: 1px solid var(--line); border-radius: 9px; padding: 0 10px; background: #f8fafc; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; }
.settings-permission-options > label:has(input:checked) { border-color: #b9cbee; background: var(--blue-soft); color: var(--blue); }
.settings-permission-options input { width: 17px; height: 17px; accent-color: var(--blue); }
.settings-permission-options .form-hint { flex-basis: 100%; margin: 0; }

@media (max-width: 960px) {
  .settings-member-list { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .settings-member-card { padding: 13px; }
  .settings-member-header { align-items: stretch; flex-direction: column; }
  .settings-member-badges { justify-content: flex-start; }
  .settings-member-details > div { grid-template-columns: 1fr; gap: 5px; }
  .settings-member-actions { width: 100%; justify-self: stretch; display: grid; grid-template-columns: 1fr; }
  .settings-member-actions .button { width: 100%; min-height: 44px; }
  .settings-class-options { grid-template-columns: 1fr; max-height: 280px; }
  .settings-permission-options { display: grid; grid-template-columns: 1fr; }
  .settings-permission-options > label { min-height: 44px; }
}
