:root {
  color-scheme: light;
  --canvas: #f3f8f5;
  --paper: #fff;
  --ink: #173b38;
  --muted: #52706c;
  --border: #dcebe4;
  --accent: #14766d;
  --tint: #e8f5ef;
  --rail: #154f47;
  --rail-ink: #e5f4ef;
  font: 16px/1.5 "Noto Sans SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body, h1, h2, p { margin: 0; }
button, input, select, textarea { font: inherit; }
button, a, summary { cursor: pointer; }
button { color: inherit; }
button:disabled { opacity: .62; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.layout { min-height: 100vh; display: grid; grid-template-columns: 153px minmax(0, 1fr); }
.rail { min-width: 0; display: flex; flex-direction: column; gap: 21px; padding: 16px 10px 12px; background: var(--rail); color: var(--rail-ink); }
.brand { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 740; line-height: 1.3; white-space: nowrap; }
.brand > span { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 11px; flex: none; background: #3c8277; }
.brand img { width: 22px; height: 22px; }
.brand small { display: block; margin-top: 2px; color: #c1e7db; font-size: 11px; font-weight: 400; }
.rail nav { display: grid; gap: 6px; }
.nav-button, .rail-tools summary, .rail-footer-link {
  display: flex; align-items: center; gap: 8px; padding: 9px 8px; min-height: 37px;
  color: var(--rail-ink); border: 0; border-radius: 8px; background: transparent;
  text-align: left; font-size: 13px; line-height: 19px; font-weight: 640;
}
.nav-button img, .rail-tools img { width: 15px; height: 15px; flex: none; }
.nav-button:hover, .rail-tools summary:hover { background: #226157; }
.nav-button.active { background: #e2f4ea; color: #134e46; }
.nav-button.active img { filter: brightness(0) saturate(100%) invert(26%) sepia(19%) saturate(1128%) hue-rotate(121deg) brightness(88%); }
.rail-tools { margin-top: auto; }
.rail-tools summary { color: #b1d8cb; font-size: 11px; list-style: none; }
.rail-tools summary::-webkit-details-marker { display: none; }
.rail-footer-link { font-size: 12px; font-weight: 400; text-decoration: none; }
.rail-footer-link:hover { text-decoration: underline; }
.main { min-width: 0; }
.work-top { min-height: 52px; display: flex; align-items: center; justify-content: space-between; padding: 8px 20px; background: var(--paper); border-bottom: 1px solid #e1eee7; font-size: 13px; font-weight: 720; }
.work-user { display: flex; align-items: center; gap: 8px; }
.work-avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: #ffedc4; color: #70490b; font-weight: 800; }
.work-user .subtle { font-size: 10px; color: #457067; }
.work-body { padding: 12px 14px 15px; }
.crumb { margin-bottom: 11px; font-size: 11px; line-height: 16px; color: #476d64; }
.crumb b { margin: 0 4px; color: #6c8a80; }
.heading { margin-bottom: 11px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
h1 { font-size: 25px; line-height: 1.15; letter-spacing: -.5px; }
h2 { font-size: 16px; line-height: 1.4; }
.lead { margin-top: 4px; font-size: 12px; color: #517068; }
.subtle { color: var(--muted); font-size: 11.5px; }
.grid { display: grid; grid-template-columns: minmax(360px, 1.38fr) minmax(280px, 1fr); gap: 10px; align-items: start; }
.card, .login-card { background: var(--paper); border: 1px solid var(--border); border-radius: 13px; padding: 12px; }
.login-card { max-width: 460px; padding: 26px; margin: 40px auto; }
.login-card form { margin-top: 20px; }
.login-card > .primary { margin-top: 18px; }
.card-head, .dialog-head, .dialog-actions, .head-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-head { margin-bottom: 9px; }
.head-actions { justify-content: flex-end; gap: 7px; }
.has-icon { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.has-icon img { width: 14px; height: 14px; filter: brightness(.4) contrast(1.5); }
.pill { display: inline-block; border-radius: 50px; padding: 3px 8px; background: var(--tint); color: #1b675b; white-space: nowrap; font-size: 11px; }
.pill-wait { background: #fff1ce; color: #754c0a; }
.table-scroll { overflow-x: auto; margin-top: 9px; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 12px; line-height: 1.26; }
th { color: #496e63; background: #edf6f1; font-size: 11px; font-weight: 730; white-space: nowrap; }
th, td { border-bottom: 1px solid #e4eee8; padding: 4px 8px; height: 34px; }
td .subtle { display: block; }
.work-body td .link { min-height: 24px; padding: 2px 3px; }
form, label { display: grid; }
form { gap: 12px; }
label { gap: 4px; font-size: 12px; font-weight: 720; color: #385f55; }
input, select, textarea { width: 100%; min-width: 0; padding: 4px 9px; border: 1px solid #dce9e3; border-radius: 8px; background: #fbfdfc; color: #254f45; font-size: 13px; font-weight: 500; }
input, select { min-height: 32px; }
textarea { padding-block: 7px; resize: vertical; }
.fields { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 10px; }
.primary, .secondary, .link { min-height: 31px; padding: 4px 9px; border: 1px solid transparent; border-radius: 8px; font-size: 12px; font-weight: 710; }
.primary { background: #ffba3a; color: #462e0e; border-color: #f0af34; }
.primary:hover { background: #ffcc68; }
.secondary { background: #fff; color: #225c53; border-color: #d4e6dd; }
.secondary:hover { background: #edf6f1; }
.link { background: transparent; padding-inline: 3px; color: #146c60; }
.link:hover { text-decoration: underline; }
.notice { margin-bottom: 13px; padding: 8px 12px; border-radius: 8px; background: #e7f4ed; color: #245b4d; }
.notice.error { background: #ffeae6; color: #8c2828; }
.preview .summary { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.preview .table-scroll { max-height: 330px; }
.preview .primary { margin-top: 14px; }
dialog { color: var(--ink); background: var(--paper); border: 1px solid var(--border); border-radius: 16px; width: min(900px, 94vw); max-height: 90vh; padding: 20px; }
dialog::backdrop { background: #0c2923a6; }
.dialog-head, .dialog-actions { margin-bottom: 12px; }
.dialog-actions { margin: 12px 0 0; }
#save-lesson { margin-top: 12px; }
#word-controls { max-height: 48vh; }
#word-controls input { min-width: 115px; }
#word-controls td:last-child { white-space: nowrap; }
.checkbox-label { display: flex; align-items: center; gap: 8px; }
.checkbox-label input { width: 20px; min-height: 20px; }
#library-form, #library-assign { margin-top: 16px; }
#reading-details p { white-space: pre-wrap; }
#reading-details .preview-passage { padding: 14px; background: #f3eef9; border-radius: 12px; margin-bottom: 12px; }
#reading-details li { margin: 8px 0; }
@media (max-width: 1040px) { .grid { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: no-preference) { button, a { transition: background .14s ease, border-color .14s ease; } }
