:root {
  color-scheme: light;
  --ink: #172f29;
  --muted: #52655d;
  --paper: #f6f7f2;
  --line: #dce4dc;
  --green: #215e4d;
  --sidebar: #153b32;
  --lime: #d6ea9f;
  --radius: 12px;
  --cell: 120px;
  font-family: "PingFang HK", "Noto Sans TC", "Microsoft JhengHei", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button, input, select, textarea { color: inherit; }
input, select, textarea { min-width: 0; max-width: 100%; }
:focus-visible { outline: 3px solid #ae6e21; outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.9rem, 3.1vw, 2.7rem); line-height: 1.16; letter-spacing: .025em; }
h2 { font-size: 1.08rem; }
h2 small { margin-inline-start: .4rem; font-size: .82rem; color: var(--muted); font-weight: 500; }
small { font-size: .82em; }
.skip { position: fixed; top: -100px; left: 12px; z-index: 20; background: white; padding: 12px; }
.skip:focus { top: 12px; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 224px; z-index: 5;
  padding: 29px 17px 16px; display: flex; flex-direction: column;
  background: var(--sidebar); color: #eaf1e9;
}
.brand { display: flex; gap: 11px; align-items: center; text-decoration: none; font-size: 1.22rem; font-weight: 800; letter-spacing: .06em; padding: 0 8px; }
.brand small { display: block; font-size: .55rem; letter-spacing: .16em; color: #b5cec2; margin-top: 1px; }
.brand-mark { width: 38px; height: 38px; flex: 0 0 38px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 3px; background: var(--lime); border-radius: 10px; padding: 8px; }
.brand-mark i { border-radius: 2px; background: var(--sidebar); }
.brand-mark i:nth-child(2) { opacity: .55; }
.brand-mark i:nth-child(3) { opacity: .72; }
.nav-label { padding: 0 10px; margin: 44px 0 9px; font-size: .72rem; color: #c3d9ce; letter-spacing: .08em; }
.nav-label span { font-size: .57rem; margin-inline-start: 6px; letter-spacing: .13em; }
.sidebar nav { display: grid; gap: 4px; }
.sidebar nav a { display: flex; gap: 11px; align-items: center; padding: 10px 11px; border-radius: 7px; text-decoration: none; font-weight: 650; white-space: nowrap; }
.sidebar nav a span { width: 20px; font-size: 1.16rem; line-height: 1; text-align: center; font-family: system-ui, sans-serif; }
.sidebar nav a:hover { background: #ffffff14; }
.sidebar nav a[aria-current] { background: var(--lime); color: var(--sidebar); }
.profile { margin-top: auto; border-top: 1px solid #ffffff32; padding: 14px 2px 0; display: flex; align-items: center; gap: 9px; }
.avatar { border-radius: 50%; background: #376255; min-width: 34px; height: 34px; display: grid; place-items: center; font-weight: 800; }
.profile-name { min-width: 0; flex: 1; }
.profile-name strong { display: block; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; font-size: .72rem; }
.profile-name small { display: block; color: #ccddd3; font-size: .67rem; }
.logout { background: transparent; border: 1px solid #ffffff45; border-radius: 6px; font-size: .95rem; color: white; min-width: 30px; height: 31px; }
.logout:hover { background: #ffffff20; }
.app { margin-left: 224px; min-width: 0; }
.topbar { min-height: 62px; border-bottom: 1px solid var(--line); background: #fcfdf9; padding: 9px 34px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.school-name { display: flex; align-items: center; gap: 9px; font-weight: 700; }
.school-dot { width: 9px; height: 9px; background: #4b876f; border-radius: 50%; flex: 0 0 9px; }
.topbar form { display: flex; align-items: center; gap: 9px; }
.topbar label { color: var(--muted); font-size: .83rem; white-space: nowrap; }
.content { max-width: 1770px; margin-inline: auto; padding: 27px 34px 55px; }
.page-heading { display: flex; gap: 16px; align-items: end; justify-content: space-between; flex-wrap: wrap; margin-bottom: 22px; }
.eyebrow { color: #34644f; font-family: system-ui, sans-serif; font-size: .71rem; letter-spacing: .17em; font-weight: 800; margin-bottom: 8px; }
.lede { margin-top: 8px; color: var(--muted); font-size: .88rem; }
.actions, .compact-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: .34rem; min-height: 38px; padding: 7px 13px; text-decoration: none; background: #fff; font-weight: 680; font-size: .87rem; border: 1px solid #cdd9d0; border-radius: 7px; }
.button:hover { background: #eff6ef; }
.button.primary { background: var(--green); border-color: var(--green); color: #fff; }
.button.primary:hover { background: #174638; }
.button.danger, .text-button { color: #902e27; }
.button.danger:hover { background: #f9eeeb; }
.quiet-link, .text-button { font-weight: 650; text-underline-offset: .18em; }
.quiet-link { color: #235d4b; }
.text-button { border: 0; background: transparent; text-decoration: underline; padding: 4px 0; }
.summary { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.summary > div { padding: 12px 16px; min-width: 0; }
.summary > div + div { border-inline-start: 1px solid var(--line); }
.summary span { display: block; color: var(--muted); font-size: .77rem; letter-spacing: .02em; }
.summary strong { display: block; font-size: 1.5rem; line-height: 1.24; margin-top: 4px; overflow-wrap: anywhere; }
.summary small { font-size: .73rem; color: var(--muted); font-weight: 550; }
.surface { background: white; border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.section-bar { min-height: 58px; padding: 10px 15px; display: flex; align-items: center; gap: 12px; justify-content: space-between; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.segmented { display: inline-flex; gap: 3px; padding: 3px; border-radius: 8px; background: #eef3ec; }
.segmented a { padding: 5px 12px; font-weight: 650; font-size: .85rem; text-decoration: none; white-space: nowrap; color: #425f53; border-radius: 6px; }
.segmented a:hover { background: #e1ebe2; }
.segmented a[aria-current] { background: #fff; color: #154737; box-shadow: 0 1px 3px #163d3024; }
.slider-label { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--muted); }
.slider-label output { width: 47px; text-align: end; font-variant-numeric: tabular-nums; }
input[type="range"] { width: 98px; accent-color: var(--green); }
.filters { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; padding: 9px 15px 12px; }
.filters label { display: grid; gap: 3px; font-size: .77rem; color: var(--muted); font-weight: 620; }
.filters .quiet-link { align-self: center; }
input:not([type="hidden"],[type="checkbox"],[type="range"],[type="radio"]), select, textarea { border: 1px solid #c8d5cb; border-radius: 7px; background: #fff; min-height: 37px; padding: 6px 9px; }
select { max-width: 100%; }
input[type="search"] { width: 230px; }
input[type="checkbox"] { accent-color: var(--green); width: 1rem; height: 1rem; }
.timeline-scroll, .table-scroll { overflow: auto; }
.assignment-grid th { white-space: nowrap; }
.assignment-grid th:first-child { position: sticky; inset-inline-start: 0; z-index: 1; }
.assignment-grid tbody th { background: white; }
.assignment-grid thead th:not(:first-child), .assignment-grid td { min-width: 86px; text-align: center; }
.assignment-grid td { border-inline-start: 1px solid var(--line); }
.assignment-periods input { width: 62px; }
.assignment-periods .quiet-link, .assignment-periods small { display: block; margin-top: 4px; }
.assignment-grid tbody td { padding: 0; }
.assignment-check { display: grid; min-height: 40px; place-items: center; cursor: pointer; }
.assignment-grid td:has(input:checked) { background: #eaf3ed; }
.draft-results { max-height: 55vh; }
.draft-results thead th { position: sticky; top: 0; }
.timeline-scroll { max-height: 67vh; border-top: 1px solid var(--line); }
.timeline { --label-width: 78px; width: max-content; min-width: 100%; }
.timeline-header, .track { display: grid; grid-template-columns: var(--label-width) repeat(var(--columns), var(--cell)); }
.timeline-header { position: sticky; top: 0; z-index: 4; background: #eef4ee; border-bottom: 1px solid #ccdacc; min-height: 49px; }
.timeline-header .corner { z-index: 5; }
.timeline-label { position: sticky; z-index: 3; left: 0; display: flex; align-items: center; padding: 0 12px; width: var(--label-width); border-right: 1px solid #d5e0d7; background: #f4f7f0; font-weight: 750; }
.timeline-header .timeline-label { background: #e6eee3; font-size: .82rem; }
.timeline-row { position: relative; display: grid; grid-template-areas: "row"; border-bottom: 1px solid var(--line); }
.timeline-row > .timeline-label, .tracks { grid-area: row; }
.timeline-row > .timeline-label { justify-self: start; align-self: stretch; }
.track { min-height: 78px; grid-template-rows: minmax(78px, auto); position: relative; }
.grid-cell { grid-row: 1; border-inline-end: 1px solid #e5ebe5; }
.week { padding: 5px 10px; border-right: 1px solid #dde7dd; }
.week strong, .week small, .week em { display: block; }
.week strong { font: 750 .84rem/1.3 system-ui, sans-serif; }
.week small { color: var(--muted); font-size: .74rem; }
.week em { font-size: .68rem; color: #614f31; font-style: normal; }
.holiday { background: #fcf4e4; }
.exam { background: #eceaf5; }
.unit-card { position: relative; grid-row: 1; z-index: 1; margin: 7px 4px; min-width: 0; padding: 6px 8px; background: color-mix(in srgb, var(--tone) 11%, #fff); border: 1px solid color-mix(in srgb, var(--tone) 31%, #fff); border-left: 3px solid var(--tone); border-radius: 6px; font-size: .82rem; }
.unit-card:hover, .unit-card:focus-within { z-index: 2; }
.unit-title { text-decoration: none; display: block; font-weight: 750; line-height: 1.3; overflow-wrap: anywhere; }
.unit-title:hover { text-decoration: underline; }
.unit-meta { font-size: .69rem; margin-top: 3px; color: #40554c; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tags { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; }
.tag, .code, .flag { display: inline-block; padding: 0 5px; border-radius: 4px; font-size: .72rem; font-weight: 730; }
.tag { background: color-mix(in srgb, var(--tone, #3f7660) 16%, white); color: #1e3d32; }
.code { background: #e6f1e8; color: #245744; }
.flag { background: #f8e1db; color: #7f2a21; }
.flag.neutral { background: #e6f1e8; color: #245744; }
.unit-preview { display: none; position: absolute; z-index: 3; top: calc(100% + 2px); left: 0; width: clamp(165px, 27vw, 300px); padding: 9px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 7px; box-shadow: 0 5px 15px #132f2324; white-space: normal; }
.unit-card:hover .unit-preview, .unit-card:focus-within .unit-preview { display: block; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; padding: 9px 15px; font-size: .75rem; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 5px; }
.swatch { width: 13px; height: 13px; border: 1px solid #0002; border-radius: 3px; display: inline-block; }
.swatch.shortage { background: #f8e1db; }
.map-note, .private-note { padding: 10px 15px; color: var(--muted); }
.block { margin-top: 16px; }
.empty { padding: 29px 16px; text-align: center; color: var(--muted); }
.empty h2 { color: var(--ink); }
.empty p { margin-top: 5px; }
.empty .button { margin-top: 12px; }
.message { padding: 10px 14px; margin-bottom: 13px; border: 1px solid #c8daca; border-radius: 7px; color: #234d3a; background: #edf5eb; }
.message.error, .errorlist { background: #fff0ed; color: #7d251e; }
.message.error { border-color: #e5afa4; }
.errorlist { padding: 6px 10px 6px 26px; margin: 0 0 4px; border-radius: 5px; }
.form-fields { display: grid; gap: 12px; align-items: start; }
.form-fields > div:not(.actions) > label, .form-fields legend { display: block; margin-bottom: 3px; font-weight: 700; }
.form-fields input:not([type="checkbox"],[type="hidden"]), .form-fields textarea, .form-fields select { width: 100%; }
.form-fields > .button { justify-self: start; }
.form-fields fieldset { border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; min-width: 0; }
.form-fields fieldset > div { display: grid; gap: 5px 10px; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); max-height: 180px; overflow: auto; }
.form-fields .helptext, .muted { color: var(--muted); font-size: .83rem; }
.inline-editor { padding: 15px; background: #f7faf6; border-bottom: 1px solid var(--line); grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); }
.inline-editor .actions, .inline-editor > .errorlist { grid-column: 1 / -1; }
.inline { display: inline-block; margin-inline-start: 6px; }
.drawer { position: fixed; inset: 0 0 0 auto; margin: 0; border: 0; padding: 22px 24px; width: min(100%, 500px); max-width: 100%; height: 100%; max-height: 100%; overflow: auto; background: #fcfdf9; color: var(--ink); box-shadow: -12px 0 40px #142c2240; }
.drawer::backdrop { background: #15342b75; }
.drawer header { display: flex; justify-content: space-between; align-items: start; gap: 13px; margin-bottom: 16px; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.drawer h2 { font-size: 1.45rem; }
.drawer header .button { font-size: 1.25rem; min-width: 38px; padding: 0; }
.detail dt { color: var(--muted); font-weight: 700; }
.detail dd { margin: 2px 0 13px; overflow-wrap: anywhere; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; text-align: start; }
th, td { text-align: start; padding: 9px 12px; border-bottom: 1px solid var(--line); }
thead th { background: #edf3ec; white-space: nowrap; }
tbody th { font-weight: 730; }
tbody tr:last-child > * { border-bottom: 0; }
td small, th small { color: var(--muted); }
.schedule-table { min-width: 670px; table-layout: fixed; }
.schedule-table th:first-child { width: 62px; }
.schedule-table th, .schedule-table td { border-right: 1px solid var(--line); }
.schedule-table td { position: relative; height: 77px; vertical-align: top; padding: 5px; }
.schedule-table td.unavailable { background: #f4f6f2; color: var(--muted); text-align: center; }
.slot-time { margin: 0 1px 4px; color: var(--muted); font-size: .64rem; }
.period { font: 750 1.1rem/1 system-ui, sans-serif; }
.scheduled { border: 1px solid color-mix(in srgb, var(--tone) 30%, white); border-left: 3px solid var(--tone); border-radius: 5px; background: color-mix(in srgb, var(--tone) 11%, white); padding: 5px; display: block; text-align: start; width: 100%; overflow-wrap: anywhere; font-size: .78rem; }
.scheduled span, .scheduled small { display: block; }
.scheduled span { color: var(--muted); font-size: .73rem; }
.empty-slot { width: 100%; border: 1px dashed #c5d9ca; min-height: 28px; border-radius: 5px; color: #2f705b; background: #f8fbf7; }
.empty-slot:hover { background: #e4f2e8; }
.palette { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 9px 13px; border-bottom: 1px solid var(--line); font-size: .84rem; }
.palette > span { color: var(--muted); font-weight: 680; }
.lesson-source small { padding: 0 3px; background: #e6f1e8; color: #245744; border-radius: 3px; }
[draggable="true"] { cursor: grab; }
.drop-active { outline: 2px solid #367258; outline-offset: -2px; background: #e9f5e9; }
.drop-error { outline: 2px solid #b13c32; outline-offset: -2px; background: #fff0ed; }
.unit-list { margin: 0; padding: 10px 20px 10px 37px; }
.unit-list li + li { margin-top: 5px; }
.heatmap th, .heatmap td { text-align: center; min-width: 84px; border-inline-end: 1px solid var(--line); white-space: nowrap; }
.heatmap th:first-child { text-align: start; min-width: 100px; position: sticky; left: 0; background: #edf3ec; }
.heatmap small { display: block; }
.heatmap td.short { background: #f9e5df; color: #752c26; font-weight: 700; }
.heatmap td.short small { color: inherit; }
.heatmap td.sufficient { background: #eaf3e7; }
.cover-actions { margin-top: 5px; }
.cover-actions select { min-height: 34px; }
.settings-layout { display: grid; grid-template-columns: minmax(145px, 180px) minmax(0, 1fr); align-items: start; gap: 14px; }
.settings-nav { padding: 6px; display: grid; gap: 2px; }
.settings-nav a { padding: 6px 9px; text-decoration: none; border-radius: 6px; font-size: .83rem; }
.settings-nav a:hover, .settings-nav a[aria-current] { background: #e9f1e7; color: #19533e; font-weight: 700; }
.settings-content { overflow: auto; }
.transfer-body { padding: 14px; }
.transfer-body p { margin-bottom: 10px; color: var(--muted); }
.transfer-body .form-fields { margin-top: 11px; max-width: 440px; }
.check { display: flex; align-items: center; gap: 5px; }
.print-only { display: none; }
.signed-out .app { margin: 0; }
.login-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .84fr); }
.login-art { position: relative; isolation: isolate; overflow: hidden; padding: clamp(26px, 5vw, 80px); color: #fff; background: var(--sidebar); display: flex; flex-direction: column; justify-content: space-between; min-height: 470px; }
.login-art .brand { padding: 0; }
.login-art-title { position: relative; padding-bottom: 14%; font-size: clamp(2.5rem, 5vw, 5.25rem); letter-spacing: .04em; font-weight: 850; line-height: 1.2; }
.login-art-title span { color: var(--lime); }
.art-grid { position: absolute; z-index: -1; width: 560px; height: 490px; right: -156px; bottom: -84px; transform: rotate(-12deg); background-image: linear-gradient(#c6eaaf28 1px, transparent 1px), linear-gradient(90deg, #c6eaaf28 1px, transparent 1px); background-size: 56px 56px; }
.art-grid i { position: absolute; height: 39px; right: 60px; top: 11px; width: 136px; background: #cde88c; border-radius: 6px; }
.art-grid i:nth-child(2) { width: 179px; top: 67px; right: 123px; background: #6da88c; }
.art-grid i:nth-child(3) { width: 97px; top: 123px; right: 65px; background: #e9cd89; }
.art-grid i:nth-child(4) { width: 167px; top: 179px; right: 169px; background: #77ad94; }
.art-grid i:nth-child(5) { width: 105px; top: 235px; right: 223px; background: #cde88c; }
.login-panel { display: grid; place-items: center; padding: 26px; }
.login-panel > div { width: min(100%, 370px); }
.login-panel form { margin-top: 22px; }
.login-panel .primary { width: 100%; justify-content: space-between; }
@media (max-width: 960px) {
  .sidebar { width: 185px; padding-inline: 12px; }
  .app { margin-left: 185px; }
  .content, .topbar { padding-inline: 19px; }
}
@media (max-width: 730px) {
  .sidebar { position: static; width: auto; padding: 10px 12px; gap: 8px; }
  .sidebar nav { display: flex; overflow-x: auto; gap: 5px; }
  .sidebar nav a { padding: 6px 8px; font-size: .78rem; }
  .sidebar nav a span, .nav-label, .profile .profile-name { display: none; }
  .profile { position: absolute; top: 11px; right: 13px; border: 0; margin: 0; padding: 0; }
  .app { margin-left: 0; }
  .topbar { min-height: 49px; }
  .content { padding-top: 17px; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { display: flex; flex-wrap: wrap; }
  .login-layout { grid-template-columns: 1fr; }
  .login-art { min-height: 180px; gap: 22px; }
  .login-art-title { padding: 0; font-size: 2rem; }
}
@media (max-width: 415px) {
  .summary { grid-template-columns: repeat(2, 1fr); }
  .summary > div:nth-child(3) { border-inline-start: 0; }
  .summary > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .school-name { font-size: .78rem; }
  .filters input[type="search"] { width: 170px; }
  .page-heading { align-items: start; }
}
@page { size: A4 landscape; margin: 10mm; }
@media print {
  * { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  body { background: white; font-size: 10pt; }
  .no-print, .skip, .timeline-screen, dialog, .unit-preview { display: none !important; }
  .app { margin: 0; }
  .content { padding: 0; max-width: none; }
  .page-heading { margin-bottom: 8px; }
  .page-heading h1 { font-size: 20pt; }
  .print-only { display: block; }
  .table-scroll, .timeline-scroll { overflow: visible; max-height: none; }
  .timeline { --label-width: 12mm; --cell: calc((100% - var(--label-width)) / var(--columns)); width: 100%; }
  .timeline-header, .timeline-label { position: static; }
  .timeline-scroll { border-left: 1px solid var(--line); }
  .map-print-page + .map-print-page { break-before: page; }
  .map-print-page h2 { margin-bottom: 6px; }
  .track { min-height: 34px; grid-template-rows: minmax(34px, auto); }
  .unit-card { margin: 3px; }
  .schedule-table { min-width: 0; font-size: 9pt; }
  .schedule-table td { height: auto; }
  .cover-record, tr, .timeline-row { break-inside: avoid; }
}
