:root {
    color-scheme: light;
    --ink: #172126;
    --muted: #66737a;
    --line: #dbe2e4;
    --line-strong: #c4ced1;
    --surface: #ffffff;
    --canvas: #f4f6f6;
    --soft: #edf4f2;
    --accent: #126b5d;
    --accent-strong: #0b5046;
    --accent-soft: #dceee9;
    --warm: #b85f31;
    --warm-soft: #f8e7dd;
    --danger: #a33737;
    --danger-soft: #fff0f0;
    --success: #226849;
    --shadow: 0 8px 24px rgba(23, 33, 38, .08);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--canvas); }

body {
    min-height: 100vh;
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
    font-size: 15px;
    line-height: 1.55;
    letter-spacing: 0;
}

button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, select { cursor: pointer; }
a { color: var(--accent); }
h1, h2, h3, p, dl { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: 30px; line-height: 1.25; }
h2 { margin-bottom: 4px; font-size: 20px; line-height: 1.3; }
.muted { color: var(--muted); }
.eyebrow { margin-bottom: 4px; color: var(--accent); font-size: 12px; font-weight: 750; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.skip-link { position: fixed; left: 12px; top: -80px; z-index: 100; padding: 8px 12px; background: var(--ink); color: white; }
.skip-link:focus { top: 12px; }

.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.topbar { position: sticky; top: 0; z-index: 30; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .96); }
.topbar__inner { width: min(1180px, calc(100% - 40px)); min-height: 62px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { min-width: 0; display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 760; text-decoration: none; }
.brand__mark { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 6px; background: var(--accent); color: white; font-size: 17px; font-weight: 800; }
.desktop-nav { display: flex; align-items: center; gap: 4px; }
.desktop-nav a { padding: 8px 12px; border-radius: 4px; color: var(--muted); text-decoration: none; }
.desktop-nav a:hover, .desktop-nav a.is-active { background: var(--soft); color: var(--accent-strong); }
.desktop-nav form { margin: 0 0 0 6px; }
.icon-button { width: 40px; height: 40px; padding: 0; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); }
.icon-button:hover { border-color: var(--accent); color: var(--accent); }
.icon-button:disabled { cursor: not-allowed; opacity: .4; }

.main { width: min(1180px, calc(100% - 40px)); min-height: calc(100vh - 132px); margin: 0 auto; padding: 34px 0 58px; }
.footer { min-height: 70px; padding: 22px 20px; display: flex; align-items: center; justify-content: center; gap: 18px; border-top: 1px solid var(--line); color: var(--muted); text-align: center; font-size: 12px; }
.footer a { color: var(--muted); }
.bottom-nav { display: none; }

.welcome-band { min-height: 120px; margin-bottom: 22px; display: flex; align-items: center; justify-content: space-between; gap: 28px; border-bottom: 1px solid var(--line); }
.welcome-band h1 { font-size: 32px; }
.welcome-band p:last-child { margin-bottom: 18px; }
.privacy-status { padding: 10px 13px; display: inline-flex; align-items: center; gap: 8px; border: 1px solid #bad6ce; border-radius: 6px; background: var(--accent-soft); color: var(--accent-strong); font-size: 13px; font-weight: 700; white-space: nowrap; }
.announcement { min-height: 48px; margin: 0 0 28px; padding: 11px 14px; display: flex; align-items: center; gap: 12px; border-left: 3px solid var(--warm); background: var(--surface); }
.announcement__label { flex: 0 0 auto; color: var(--warm); font-size: 12px; font-weight: 800; }
.announcement p { margin: 0; color: #4e5a60; }
.section-heading { min-height: 56px; display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.section-heading h2 { margin-bottom: 10px; }
.action-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.action-card { min-height: 118px; padding: 20px; display: grid; grid-template-columns: 52px 1fr 22px; align-items: center; gap: 15px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); text-decoration: none; }
.action-card:hover { border-color: #91b8af; box-shadow: var(--shadow); transform: translateY(-1px); }
.action-card__icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 8px; }
.action-card__icon .icon { width: 25px; height: 25px; }
.action-card--timetable .action-card__icon { background: var(--accent-soft); color: var(--accent); }
.action-card--grades .action-card__icon { background: var(--warm-soft); color: var(--warm); }
.action-card strong, .action-card small { display: block; }
.action-card strong { margin-bottom: 4px; font-size: 18px; }
.action-card small { color: var(--muted); font-size: 13px; }
.action-card__arrow { justify-self: end; color: #8c989e; }
.service-list { margin-top: 30px; }
.service-row { min-height: 72px; padding: 12px 14px; display: grid; grid-template-columns: 42px 1fr 20px; align-items: center; gap: 13px; border-top: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; }
.service-row:last-child { border-bottom: 1px solid var(--line); }
.service-row:hover { background: #fafcfc; }
.service-row__icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }
.service-row__icon--warm { background: var(--warm-soft); color: var(--warm); }
.service-row strong, .service-row small { display: block; }
.service-row > span:not(.service-row__icon) { min-width: 0; }
.service-row strong, .service-row small { overflow-wrap: anywhere; }
.service-row small { margin-top: 2px; color: var(--muted); font-size: 12px; }

.is-guest { background: #fff; }
.is-guest .topbar { position: static; border-bottom-color: #e5e7e8; background: #f5f6f6; }
.is-guest .topbar__inner { justify-content: center; }
.is-guest .brand { width: 100%; max-width: 100%; justify-content: center; text-align: center; }
.is-guest .brand > span:last-child { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.is-guest .brand__mark { display: none; }
.is-guest .main { width: 100%; min-height: calc(100vh - 62px); padding: 0 20px; background: #fff; }
.is-guest .footer { display: none; }
.login-page { width: min(100%, 430px); margin: 0 auto; padding: 68px 0 44px; }
.login-hero { margin-bottom: 28px; text-align: center; }
.login-eyebrow { margin-bottom: 7px; color: var(--accent); font-size: 12px; font-weight: 760; }
.login-hero h1 { margin-bottom: 18px; color: #202528; font-size: 40px; font-weight: 650; line-height: 1.2; letter-spacing: 0; }
.login-school-name { margin: 0; color: #5d696f; font-size: 16px; overflow-wrap: anywhere; }
.login-panel { min-width: 0; }
.login-panel .alert { margin-bottom: 14px; }
.login-form { display: grid; gap: 15px; }
.login-fields { overflow: hidden; border: 1px solid #e2e5e6; border-radius: 6px; background: #f5f6f6; }
.login-field { min-height: 56px; background: #f5f6f6; }
.login-field + .login-field { border-top: 1px solid #e2e5e6; }
.login-field:focus-within { position: relative; z-index: 1; box-shadow: inset 0 0 0 2px #287565; }
.login-field input { min-height: 56px; padding: 0 16px; border: 0; border-radius: 0; background: transparent; font-size: 16px; }
.login-field input:focus { outline: 0; }
.login-field input::placeholder { color: #626e73; opacity: 1; }
.login-submit { width: 100%; min-height: 52px; padding: 10px 16px; border: 0; border-radius: 5px; background: #363d41; color: #fff; font-weight: 720; }
.login-submit:hover { background: #20262a; }
.login-captcha { margin: 0; padding: 13px 14px 12px; border: 1px solid #e2e5e6; border-radius: 6px; background: #fbfcfc; }
.login-captcha legend { padding: 0 5px; color: #40534f; font-size: 12px; font-weight: 760; }
.login-captcha__row { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) 120px 40px; align-items: center; gap: 8px; }
.login-captcha__row input { min-width: 0; min-height: 44px; padding: 8px 10px; border: 1px solid #b9c4c8; border-radius: 5px; background: #fff; }
.login-captcha__image { width: 120px; height: 42px; display: block; object-fit: contain; border: 1px solid #cbd5d7; border-radius: 4px; background: #fff; }
.login-captcha__refresh { width: 40px; height: 40px; padding: 0; display: inline-grid; place-items: center; border: 1px solid #c4ced1; border-radius: 5px; background: #fff; color: #405057; }
.login-captcha__refresh:hover { border-color: var(--accent); color: var(--accent); }
.login-captcha__refresh .icon { width: 18px; height: 18px; }
.login-captcha__hint { margin: 8px 0 0; color: #69767a; font-size: 11px; line-height: 1.5; }
.login-information { margin-top: 30px; text-align: center; }
.login-privacy { padding: 12px 13px; display: flex; align-items: flex-start; gap: 9px; border: 1px solid #dce7e4; border-radius: 6px; background: #f4f8f7; color: #40534f; text-align: left; font-size: 13px; line-height: 1.65; }
.login-privacy .icon { width: 18px; height: 18px; margin-top: 2px; color: var(--accent); }
.login-privacy span, .login-copy, .login-text-link, .login-footer-note { overflow-wrap: anywhere; }
.login-copy { margin: 22px 0 0; color: #59666b; text-align: left; font-size: 13px; line-height: 1.8; white-space: pre-line; }
.login-links { margin-top: 18px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; }
.login-text-link { min-height: 34px; display: inline-flex; align-items: center; color: var(--accent); font-size: 14px; font-weight: 700; text-underline-offset: 3px; }
.login-footer-note { margin: 30px 0 0; color: #616d72; font-size: 12px; white-space: pre-line; }
.login-submit:focus-visible, .login-text-link:focus-visible { outline-color: #287565; }
@supports (min-height: 100dvh) {
    .is-guest .main { min-height: calc(100dvh - 62px); }
}
.form { display: grid; gap: 9px; }
.form label, .field > span { color: #344149; font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid #b9c4c8; border-radius: 5px; background: var(--surface); color: var(--ink); }
input, select { min-height: 42px; padding: 8px 10px; }
textarea { min-height: 92px; padding: 10px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid #74b7a8; outline-offset: 2px; }
.button { min-height: 42px; padding: 8px 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 5px; font-weight: 730; text-decoration: none; }
.button--wide { width: 100%; margin-top: 13px; }
.button--primary { background: var(--accent); color: white; }
.button--primary:hover { background: var(--accent-strong); }
.button--secondary { border-color: var(--line-strong); background: var(--surface); color: var(--ink); }
.button--secondary:hover { border-color: #8da39f; }
.button--danger-quiet { border-color: #e3bcbc; background: var(--surface); color: var(--danger); }
.button--dark { background: #20262b; color: white; }
.button--dark:hover { background: #0d1114; }
.alert { margin: 0 0 18px; padding: 11px 13px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--surface); }
.alert--error { border-color: #e3bcbc; background: var(--danger-soft); color: var(--danger); }
.alert--success { border-color: #acd2bd; background: #edf8f1; color: var(--success); }

.page-heading { margin-bottom: 24px; }
.page-heading--inline { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.term-form { display: grid; grid-template-columns: minmax(170px, 1fr) minmax(118px, .7fr) auto; align-items: center; gap: 8px; }
.term-form select { background-color: var(--surface); }
.term-form .button { min-width: 94px; }

.week-toolbar { min-height: 58px; padding: 8px 10px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-bottom: 0; background: var(--surface); }
.week-nav { width: 38px; height: 38px; }
.week-picker select { width: 104px; min-height: 38px; font-weight: 720; }
.week-range { margin-left: 5px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.timetable-actions { margin-left: auto; display: flex; gap: 6px; }
.tool-button { min-height: 38px; padding: 7px 10px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: #405057; }
.tool-button:hover { border-color: var(--accent); color: var(--accent); }
.tool-button:disabled { cursor: not-allowed; opacity: .42; }
.tool-button .icon { width: 18px; height: 18px; }
.schedule-scroll { overflow-x: auto; border: 1px solid var(--line); background: var(--surface); scrollbar-color: #aab8bc transparent; }
.schedule-grid { min-width: 850px; display: grid; grid-template-columns: 64px repeat(7, minmax(112px, 1fr)); grid-template-rows: 58px repeat(11, 66px); position: relative; isolation: isolate; }
.schedule-corner, .schedule-day { position: sticky; top: 0; z-index: 7; display: flex; align-items: center; justify-content: center; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #f0f4f4; }
.schedule-corner { left: 0; grid-column: 1; grid-row: 1; color: var(--muted); font-size: 12px; }
.schedule-day { flex-direction: column; line-height: 1.25; }
.schedule-day strong { font-size: 13px; }
.schedule-day span { min-height: 16px; margin-top: 3px; color: var(--muted); font-size: 11px; }
.schedule-day.is-today { background: var(--accent-soft); color: var(--accent-strong); }
.schedule-day-1, .schedule-slot-day-1, .course-day-1 { grid-column: 2; }
.schedule-day-2, .schedule-slot-day-2, .course-day-2 { grid-column: 3; }
.schedule-day-3, .schedule-slot-day-3, .course-day-3 { grid-column: 4; }
.schedule-day-4, .schedule-slot-day-4, .course-day-4 { grid-column: 5; }
.schedule-day-5, .schedule-slot-day-5, .course-day-5 { grid-column: 6; }
.schedule-day-6, .schedule-slot-day-6, .course-day-6 { grid-column: 7; }
.schedule-day-7, .schedule-slot-day-7, .course-day-7 { grid-column: 8; }
.schedule-time { position: sticky; left: 0; z-index: 5; padding: 5px 3px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #f8fafa; color: var(--muted); text-align: center; }
.schedule-time strong { color: var(--ink); font-size: 13px; }
.schedule-time span { margin-top: 2px; font-size: 9px; line-height: 1.15; }
.schedule-slot { z-index: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); }
.schedule-time-1, .schedule-slot-section-1 { grid-row: 2; }
.schedule-time-2, .schedule-slot-section-2 { grid-row: 3; }
.schedule-time-3, .schedule-slot-section-3 { grid-row: 4; }
.schedule-time-4, .schedule-slot-section-4 { grid-row: 5; }
.schedule-time-5, .schedule-slot-section-5 { grid-row: 6; }
.schedule-time-6, .schedule-slot-section-6 { grid-row: 7; }
.schedule-time-7, .schedule-slot-section-7 { grid-row: 8; }
.schedule-time-8, .schedule-slot-section-8 { grid-row: 9; }
.schedule-time-9, .schedule-slot-section-9 { grid-row: 10; }
.schedule-time-10, .schedule-slot-section-10 { grid-row: 11; }
.schedule-time-11, .schedule-slot-section-11 { grid-row: 12; }
.course-block { z-index: 2; min-width: 0; margin: 3px; padding: 7px 6px; overflow: hidden; border: 0; border-left: 3px solid currentColor; border-radius: 5px; text-align: left; line-height: 1.25; box-shadow: 0 2px 7px rgba(23, 33, 38, .08); }
.course-block:hover { z-index: 4; box-shadow: 0 7px 18px rgba(23, 33, 38, .17); }
.course-block strong, .course-block span { display: block; overflow: hidden; }
.course-block strong { max-height: 3.75em; color: #152025; font-size: 12px; }
.course-block span { margin-top: 5px; color: #4f5b61; font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }
.course-start-1 { grid-row-start: 2; }.course-start-2 { grid-row-start: 3; }.course-start-3 { grid-row-start: 4; }.course-start-4 { grid-row-start: 5; }
.course-start-5 { grid-row-start: 6; }.course-start-6 { grid-row-start: 7; }.course-start-7 { grid-row-start: 8; }.course-start-8 { grid-row-start: 9; }
.course-start-9 { grid-row-start: 10; }.course-start-10 { grid-row-start: 11; }.course-start-11 { grid-row-start: 12; }
.course-span-1 { grid-row-end: span 1; }.course-span-2 { grid-row-end: span 2; }.course-span-3 { grid-row-end: span 3; }.course-span-4 { grid-row-end: span 4; }
.course-span-5 { grid-row-end: span 5; }.course-span-6 { grid-row-end: span 6; }.course-span-7 { grid-row-end: span 7; }.course-span-8 { grid-row-end: span 8; }
.course-color-0 { color: #176f62; background: #d9eee9; }.course-color-1 { color: #875027; background: #f7e5d5; }
.course-color-2 { color: #3a5f91; background: #e0eaf6; }.course-color-3 { color: #7a477d; background: #efe2f0; }
.course-color-4 { color: #8a3f4e; background: #f6e0e4; }.course-color-5 { color: #526b2f; background: #e9efd9; }
.course-color-6 { color: #7a5d18; background: #f5ebc9; }.course-color-7 { color: #34636d; background: #dcecef; }
.schedule-empty { padding: 18px; border: 1px solid var(--line); border-top: 0; background: var(--surface); color: var(--muted); text-align: center; }
.operation-status { min-height: 22px; margin: 8px 0 0; color: var(--accent-strong); font-size: 12px; }
.course-dialog { width: min(430px, calc(100% - 28px)); padding: 26px; border: 0; border-radius: 8px; color: var(--ink); box-shadow: 0 22px 70px rgba(0, 0, 0, .24); }
.course-dialog::backdrop { background: rgba(17, 26, 30, .54); }
.dialog-close-form { position: absolute; top: 12px; right: 12px; }
.dialog-close-form .icon-button { width: 34px; height: 34px; }
.course-dialog h2 { max-width: calc(100% - 40px); margin-bottom: 22px; overflow-wrap: anywhere; font-size: 23px; }
.course-details { margin-bottom: 0; }
.course-details div { padding: 9px 0; display: grid; grid-template-columns: 62px 1fr; gap: 14px; border-top: 1px solid var(--line); }
.course-details dt { color: var(--muted); }.course-details dd { margin: 0; font-weight: 650; }

.grade-summary { margin-bottom: 16px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); background: var(--surface); }
.grade-summary div { min-height: 86px; padding: 16px 20px; display: flex; flex-direction: column; justify-content: center; border-right: 1px solid var(--line); }
.grade-summary div:last-child { border-right: 0; }
.grade-summary span { color: var(--muted); font-size: 12px; }.grade-summary strong { margin-top: 2px; font-size: 24px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); background: var(--surface); }
table { width: 100%; min-width: 720px; border-collapse: collapse; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { background: #eef2f2; color: #435158; font-size: 12px; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcfc; }
.score-badge { min-width: 40px; min-height: 28px; padding: 3px 8px; display: inline-grid; place-items: center; border-radius: 5px; background: var(--accent-soft); color: var(--accent-strong); font-weight: 800; }
.empty { padding: 34px; color: var(--muted); text-align: center; }

.settings-group { margin-bottom: 28px; }
.setting-row { min-height: 68px; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); background: var(--surface); }
.setting-row:last-child { border-bottom: 1px solid var(--line); }
.setting-row > span { min-width: 0; }.setting-row strong, .setting-row small { display: block; }.setting-row small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.setting-row--select select { width: 118px; min-height: 38px; }
.setting-row.is-disabled { opacity: .52; }
.switch { width: 44px; height: 24px; margin: 0; padding: 0; flex: 0 0 44px; appearance: none; border: 1px solid #aeb9bd; border-radius: 12px; background: #cbd2d4; position: relative; }
.switch::after { content: ""; width: 18px; height: 18px; position: absolute; top: 2px; left: 2px; border-radius: 50%; background: white; box-shadow: 0 1px 3px rgba(0,0,0,.24); transition: transform .18s ease; }
.switch:checked { border-color: var(--accent); background: var(--accent); }.switch:checked::after { transform: translateX(20px); }
.setting-actions { padding: 14px 0; display: flex; gap: 10px; }
.privacy-list { border-block: 1px solid var(--line); background: var(--surface); }
.privacy-list > div { min-height: 70px; padding: 13px 15px; display: flex; align-items: center; gap: 14px; border-bottom: 1px solid var(--line); }
.privacy-list > div:last-child { border-bottom: 0; }.privacy-list > div > .icon { color: var(--accent); }
.privacy-list strong, .privacy-list small { display: block; }.privacy-list small { color: var(--muted); font-size: 12px; }

.admin-body { background: #f2f4f4; }
.admin-topbar { border-bottom: 1px solid #333b40; background: #20262b; color: white; }
.admin-topbar__inner { width: min(1120px, calc(100% - 40px)); min-height: 64px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; }
.brand--admin { color: white; }.brand--admin .brand__mark { background: #d77a45; }
.admin-account { display: flex; align-items: center; gap: 12px; color: #c9d0d3; font-size: 13px; }.admin-account form { margin: 0; }
.icon-button--dark { border-color: #49545a; background: transparent; color: white; }
.admin-main { width: min(1120px, calc(100% - 40px)); min-height: calc(100vh - 134px); margin: 0 auto; padding: 38px 0 54px; }
.admin-footer { background: #20262b; border-top: 0; color: #adb7bb; }
.admin-login { width: min(420px, 100%); margin: 8vh auto 0; padding: 32px; border: 1px solid var(--line); border-radius: 8px; background: white; box-shadow: var(--shadow); }
.admin-login__heading { margin-bottom: 24px; }.admin-login__icon { width: 46px; height: 46px; margin-bottom: 18px; display: grid; place-items: center; border-radius: 7px; background: #e7eaeb; color: #20262b; }
.back-link { margin-top: 22px; display: inline-flex; align-items: center; gap: 5px; color: var(--muted); text-decoration: none; }.back-link .icon { width: 17px; }
.admin-heading { margin-bottom: 26px; display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.admin-section { margin-bottom: 30px; border-top: 1px solid var(--line-strong); }
.admin-section__heading { padding: 18px 0; display: grid; grid-template-columns: 36px 1fr; gap: 12px; }
.admin-section__heading > span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 5px; background: #e3e8e9; color: #536167; font-size: 11px; font-weight: 800; }
.admin-section__heading h2 { margin-bottom: 2px; }.admin-section__heading p { margin: 0; color: var(--muted); font-size: 12px; }
.admin-field-grid { padding: 20px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; background: white; border: 1px solid var(--line); }
.field { display: grid; gap: 6px; }.field--wide { grid-column: 1 / -1; }
.admin-switch-list { border: 1px solid var(--line); }.admin-switch-list .setting-row:last-child { border-bottom: 0; }
.admin-savebar { min-height: 68px; padding: 12px 14px; position: sticky; bottom: 12px; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 20px; border: 1px solid var(--line-strong); border-radius: 7px; background: rgba(255,255,255,.96); box-shadow: var(--shadow); }
.admin-savebar > span { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }.admin-savebar > span .icon { color: var(--accent); }

[hidden] { display: none !important; }

@media (max-width: 760px) {
    .topbar__inner, .main, .admin-topbar__inner, .admin-main { width: min(100% - 24px, 1180px); }
    .topbar__inner { min-height: 56px; }
    .brand__mark { width: 28px; height: 28px; }
    .desktop-nav { display: none; }
    .main { min-height: calc(100vh - 128px); padding: 22px 0 104px; }
    .footer { display: none; }
    .bottom-nav { min-height: 64px; padding: 5px max(8px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); position: fixed; inset: auto 0 0; z-index: 35; display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); background: rgba(255, 255, 255, .98); }
    .bottom-nav__item { min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 11px; text-decoration: none; }
    .bottom-nav__item .icon { width: 21px; height: 21px; }.bottom-nav__item.is-active { color: var(--accent); font-weight: 700; }
    h1 { font-size: 25px; }.welcome-band h1 { font-size: 27px; }
    .welcome-band { min-height: 110px; align-items: flex-start; flex-direction: column; gap: 2px; }.privacy-status { margin-bottom: 16px; }
    .announcement { align-items: flex-start; }
    .action-grid { grid-template-columns: 1fr; }.action-card { min-height: 94px; padding: 15px; grid-template-columns: 46px 1fr 20px; }.action-card__icon { width: 46px; height: 46px; }
    .is-guest .topbar { display: none; }
    .is-guest .main { min-height: 100vh; padding: 0 20px calc(28px + env(safe-area-inset-bottom)); }
    .login-page { padding-top: 50px; padding-bottom: 24px; }
    .login-hero { margin-bottom: 25px; }
    .login-hero h1 { font-size: 38px; }
    .login-captcha__row { grid-template-columns: minmax(0, 1fr) 112px 38px; gap: 6px; }
    .login-captcha__image { width: 112px; }
    .login-captcha__refresh { width: 38px; }
    @supports (min-height: 100dvh) { .is-guest .main { min-height: 100dvh; } }
    .page-heading--inline { align-items: stretch; flex-direction: column; gap: 15px; }
    .term-form { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) auto; }.term-form .button { min-width: 42px; padding-inline: 11px; }.term-form .button span { display: none; }
    .week-toolbar { flex-wrap: wrap; }.week-range { flex: 1; }.timetable-actions { width: 100%; margin-left: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }.tool-button { justify-content: center; }.schedule-scroll { margin-inline: -12px; border-inline: 0; }.schedule-grid { min-width: 820px; grid-template-columns: 58px repeat(7, minmax(108px, 1fr)); }
    .grade-summary div { min-height: 74px; padding: 12px; }.grade-summary strong { font-size: 21px; }
    .grade-table-wrap { border: 0; background: transparent; overflow: visible; }.grade-table { min-width: 0; }.grade-table thead { width: 1px; height: 1px; margin: -1px; padding: 0; position: absolute; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }.grade-table tbody { display: grid; gap: 10px; }.grade-table tr { padding: 13px 14px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px 12px; border: 1px solid var(--line); border-radius: 7px; background: white; }.grade-table td { min-width: 0; padding: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; border: 0; }.grade-table td::before { content: attr(data-label); margin-bottom: 2px; color: var(--muted); font-size: 10px; }.grade-table td:first-child { grid-column: 1 / -1; }.grade-table td:first-child::before { display: none; }.grade-table .empty { grid-column: 1 / -1; display: block; text-align: center; }
    .setting-actions { display: grid; grid-template-columns: 1fr 1fr; }.setting-actions .button { width: 100%; padding-inline: 9px; }
    .admin-main { padding-top: 26px; }.admin-login { margin-top: 3vh; padding: 26px 22px; }.admin-heading { align-items: stretch; flex-direction: column; }.admin-heading .button { align-self: flex-start; }.admin-field-grid { padding: 15px; grid-template-columns: 1fr; }.field--wide { grid-column: auto; }.admin-savebar { bottom: 8px; }.admin-savebar > span { display: none; }.admin-savebar .button { width: 100%; }
}

@media (max-width: 420px) {
    .tool-button span { font-size: 12px; }.week-picker select { width: 98px; }.week-range { font-size: 12px; }
    .grade-summary span { font-size: 11px; }.grade-summary strong { font-size: 19px; }
}

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

/* WeChat-oriented mobile shell, inspired by the original WeUI information layout. */
body.theme-jade {
    --accent: #087f6b;
    --accent-strong: #075f52;
    --accent-soft: #e3f3ef;
}
body.theme-ocean {
    --accent: #2467a6;
    --accent-strong: #174b7d;
    --accent-soft: #e4eff9;
}
body.theme-sunrise {
    --accent: #a94f32;
    --accent-strong: #7e3924;
    --accent-soft: #fae9e2;
}

.mobile-hero {
    min-height: 178px;
    margin-bottom: 12px;
    padding: 24px;
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    overflow: hidden;
    border-radius: 8px;
    background-color: #415c8c;
    background-image: url("campus-banner.png");
    background-blend-mode: multiply;
    background-position: center;
    background-size: cover;
    color: white;
}
.mobile-hero__content { min-width: 0; }
.mobile-hero__content p { margin: 0 0 5px; color: #dce9f5; font-size: 12px; font-weight: 700; }
.mobile-hero__content h1 { margin: 0 0 4px; color: white; font-size: 30px; }
.mobile-hero__content > span { display: block; color: #edf4fb; font-size: 13px; }
.mobile-hero__content h1, .mobile-hero__content > span { overflow-wrap: anywhere; }
.mobile-hero__week { min-width: 150px; padding-left: 18px; border-left: 1px solid rgba(255, 255, 255, .38); text-align: right; }
.mobile-hero__week span, .mobile-hero__week strong { display: block; }
.mobile-hero__week span { margin-bottom: 2px; color: #e1e9f1; font-size: 11px; }
.mobile-hero__week strong { font-size: 22px; }

.notice-strip {
    min-height: 48px;
    margin-bottom: 12px;
    padding: 8px 14px;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 8px;
    border-block: 1px solid var(--line);
    background: white;
}
.notice-strip p { margin: 0; overflow: hidden; color: #49565c; font-size: 13px; white-space: nowrap; text-overflow: ellipsis; }
.notice-strip__icon { width: 28px; height: 28px; display: grid; place-items: center; color: #d1663f; }
.notice-strip__icon .icon { width: 19px; height: 19px; }
.notice-strip__arrow { width: 16px; color: #a0aaae; }

.wechat-section { margin-bottom: 12px; background: white; }
.wechat-section__heading { min-height: 52px; padding: 12px 16px 9px; display: flex; align-items: end; justify-content: space-between; gap: 12px; border-bottom: 1px solid #edf0f1; }
.wechat-section__heading h2 { margin: 0; font-size: 17px; }
.wechat-section__heading h2 { min-width: 0; overflow-wrap: anywhere; }
.wechat-section__heading span { color: var(--muted); font-size: 11px; text-align: right; }
.wechat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.wechat-grid__item {
    min-width: 0;
    min-height: 116px;
    padding: 16px 6px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    color: var(--ink);
    text-align: center;
    text-decoration: none;
}
.wechat-grid__item:hover { background: #fafcfc; }
.wechat-grid__icon { width: 48px; height: 48px; margin-bottom: 8px; display: grid; place-items: center; border-radius: 8px; }
.wechat-grid__icon .icon { width: 25px; height: 25px; }
.wechat-grid__item strong, .wechat-grid__item small { width: 100%; display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.wechat-grid__item strong { font-size: 14px; }
.wechat-grid__item small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.service-color-green { background: #e1f3ed !important; color: #087f6b !important; }
.service-color-orange { background: #fae9df !important; color: #b45b31 !important; }
.service-color-blue { background: #e3edf8 !important; color: #326da3 !important; }
.service-color-violet { background: #eee7f7 !important; color: #72539b !important; }

.wechat-section.service-list { margin-top: 0; }
.wechat-section .service-row { border-top: 0; border-bottom: 1px solid #edf0f1; }
.wechat-section .service-row:last-child { border-bottom: 0; }
.home-privacy-note { margin: 18px 0 0; display: flex; align-items: center; justify-content: center; gap: 7px; color: #78848a; font-size: 11px; text-align: center; }
.home-privacy-note .icon { width: 15px; height: 15px; color: var(--accent); }

.calendar-month { margin-bottom: 14px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: white; }
.calendar-weekdays, .calendar-month__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-weekdays { min-height: 38px; align-items: center; border-bottom: 1px solid var(--line); background: #f2f5f5; color: var(--muted); text-align: center; font-size: 11px; font-weight: 700; }
.calendar-day { min-width: 0; min-height: 86px; padding: 8px; position: relative; border-right: 1px solid #edf0f1; border-bottom: 1px solid #edf0f1; background: white; }
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day time { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; color: #2e3a40; font-size: 12px; font-weight: 750; }
.calendar-day.is-outside { background: #fafbfb; }
.calendar-day.is-outside time { color: #b2b9bc; }
.calendar-day.is-today time { background: var(--accent); color: white; }
.calendar-day small { margin-top: 5px; display: block; overflow: hidden; color: #526067; font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }
.calendar-day__markers { min-height: 8px; margin-top: 5px; display: flex; gap: 3px; }
.calendar-dot { width: 7px; height: 7px; display: inline-block; flex: 0 0 7px; border-radius: 50%; background: #78848a; }
.calendar-dot--teaching { background: #16806d; }
.calendar-dot--exam { background: #bd5a38; }
.calendar-dot--holiday { background: #c43e4b; }
.calendar-dot--registration { background: #3776ad; }
.calendar-dot--activity { background: #7758a0; }
.calendar-legend { min-height: 40px; padding: 8px 12px; display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.calendar-legend span { display: inline-flex; align-items: center; gap: 5px; }
.calendar-event-section { margin-bottom: 14px; border: 1px solid var(--line); border-radius: 8px; background: white; overflow: hidden; }
.calendar-event-row { min-height: 86px; padding: 14px 16px; display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: start; gap: 13px; border-bottom: 1px solid #edf0f1; }
.calendar-event-row:last-child { border-bottom: 0; }
.calendar-event-row > time { width: 46px; height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 7px; background: var(--accent-soft); color: var(--accent-strong); }
.calendar-event-row > time strong { font-size: 20px; line-height: 1; }
.calendar-event-row > time span { margin-top: 3px; font-size: 10px; }
.calendar-event-row__content { min-width: 0; }
.calendar-event-row__content > strong, .calendar-event-row__content > small { display: block; }
.calendar-event-row__content > strong, .calendar-event-row__content > small { overflow-wrap: anywhere; }
.calendar-event-row__content > strong { margin: 5px 0 2px; font-size: 15px; }
.calendar-event-row__content > small { color: var(--muted); font-size: 11px; }
.calendar-event-row__category { display: inline-block; color: #526067; font-size: 10px; font-weight: 750; }
.calendar-event-row__category::before { content: ""; width: 7px; height: 7px; margin-right: 5px; display: inline-block; border-radius: 50%; background: #78848a; }
.calendar-event-row__category--teaching::before { background: #16806d; }
.calendar-event-row__category--exam::before { background: #bd5a38; }
.calendar-event-row__category--holiday::before { background: #c43e4b; }
.calendar-event-row__category--registration::before { background: #3776ad; }
.calendar-event-row__category--activity::before { background: #7758a0; }

.density-compact .wechat-grid__item { min-height: 100px; padding-block: 12px 9px; }
.density-compact .wechat-grid__icon { width: 42px; height: 42px; }
.density-compact .service-row { min-height: 62px; }

.page-heading h1 { font-size: 28px; }
.score-badge { font-variant-numeric: tabular-nums; }
.grade-summary { border-radius: 8px; overflow: hidden; }
.table-wrap { border-radius: 8px; }
.settings-group { background: transparent; }

.admin-nav { display: flex; align-items: center; gap: 4px; }
.admin-nav a { padding: 8px 11px; border-radius: 5px; color: #c9d0d3; font-size: 13px; text-decoration: none; }
.admin-nav a:hover, .admin-nav a.is-active { background: #343d42; color: white; }
.admin-topbar__tools { display: flex; align-items: center; gap: 18px; }
.admin-overview { margin: -8px 0 30px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); background: white; }
.admin-overview > div { min-height: 86px; padding: 16px; display: flex; flex-direction: column; justify-content: center; border-right: 1px solid var(--line); }
.admin-overview > div:last-child { border-right: 0; }
.admin-overview span { margin-bottom: 4px; color: var(--muted); font-size: 11px; }
.admin-overview strong { overflow-wrap: anywhere; font-size: 16px; }
.admin-choice-field { margin: 0; padding: 0; border: 0; }
.admin-choice-field legend { margin-bottom: 7px; color: #344149; font-size: 13px; font-weight: 700; }
.theme-choice-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.theme-choice { min-height: 44px; padding: 7px 10px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: white; cursor: pointer; }
.theme-choice:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.theme-choice input, .segmented-control input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.theme-choice__swatch { width: 24px; height: 24px; flex: 0 0 24px; border: 5px solid #dbece8; border-radius: 50%; background: #087f6b; }
.theme-choice__swatch--ocean { border-color: #dce8f4; background: #2467a6; }
.theme-choice__swatch--sunrise { border-color: #f4dfd7; background: #a94f32; }
.theme-choice > span:last-child { min-width: 0; overflow: hidden; font-size: 13px; white-space: nowrap; text-overflow: ellipsis; }
.segmented-control { width: min(320px, 100%); padding: 3px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; border: 1px solid var(--line-strong); border-radius: 6px; background: #f1f4f4; }
.segmented-control label { cursor: pointer; }
.segmented-control span { min-height: 34px; display: grid; place-items: center; border-radius: 4px; color: var(--muted); font-size: 13px; font-weight: 700; }
.segmented-control input:checked + span { background: white; color: var(--accent-strong); box-shadow: 0 1px 4px rgba(23, 33, 38, .1); }
.theme-choice:focus-within, .segmented-control label:focus-within span { outline: 2px solid #74b7a8; outline-offset: 2px; }

@media (max-width: 760px) {
    body { background: #f3f4f5; }
    .topbar { border-bottom-color: #e5e8e9; }
    .topbar__inner { width: 100%; padding-inline: 16px; }
    .brand { width: 100%; justify-content: center; font-size: 16px; }
    .brand__mark { position: absolute; left: 16px; }
    .main { width: 100%; padding: 12px 12px calc(88px + env(safe-area-inset-bottom)); }
    .bottom-nav { min-height: 60px; grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); box-shadow: 0 -3px 14px rgba(30, 39, 44, .06); }
    .bottom-nav__item { min-height: 50px; }
    .bottom-nav__item .icon { width: 20px; height: 20px; }

    .mobile-hero { min-height: 158px; margin-inline: -12px; margin-top: -12px; padding: 20px 18px; border-radius: 0; }
    .mobile-hero__content h1 { font-size: 26px; }
    .mobile-hero__week { min-width: 104px; padding-left: 10px; }
    .mobile-hero__week span { max-width: 104px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
    .mobile-hero__week strong { font-size: 19px; }
    .notice-strip, .wechat-section { margin-inline: -12px; }
    .wechat-section__heading { padding-inline: 14px; }
    .wechat-grid__item { min-height: 105px; padding-inline: 3px; }
    .wechat-grid__icon { width: 44px; height: 44px; }
    .wechat-grid__item strong { font-size: 13px; }
    .service-row { min-height: 66px; }
    .calendar-month { margin-inline: -12px; border-inline: 0; border-radius: 0; }
    .calendar-day { min-height: 58px; padding: 5px 4px; }
    .calendar-day time { width: 24px; height: 24px; font-size: 11px; }
    .calendar-day small { display: none; }
    .calendar-day__markers { justify-content: center; gap: 2px; }
    .calendar-dot { width: 6px; height: 6px; flex-basis: 6px; }
    .calendar-legend { justify-content: center; }
    .calendar-event-section { margin-inline: -12px; border-inline: 0; border-radius: 0; }

    .page-heading { margin: -12px -12px 12px; padding: 18px 16px 16px; background: white; }
    .page-heading--inline { gap: 12px; }
    .page-heading h1 { font-size: 23px; }
    .page-heading .eyebrow { margin-bottom: 2px; }
    .term-form { width: 100%; }
    .term-form select { min-width: 0; font-size: 13px; }

    .week-toolbar { margin-inline: -12px; position: sticky; top: 56px; z-index: 18; border-inline: 0; box-shadow: 0 3px 10px rgba(23, 33, 38, .05); }
    .schedule-scroll { max-height: calc(100vh - 250px); overflow: auto; }
    .schedule-grid { grid-template-rows: 52px repeat(11, 62px); }
    .course-block { margin: 3px 2px; padding: 6px 5px; }
    .course-dialog { padding: 23px 20px calc(23px + env(safe-area-inset-bottom)); }

    .grade-summary { margin-inline: -12px; border-inline: 0; border-radius: 0; }
    .grade-summary div { align-items: center; text-align: center; }
    .grade-table tbody { gap: 8px; }
    .grade-table tr { border-radius: 8px; box-shadow: 0 2px 8px rgba(23, 33, 38, .04); }
    .grade-table td:first-child strong { font-size: 15px; }
    .settings-group { margin-inline: -12px; margin-bottom: 12px; padding-inline: 12px; background: white; }
    .settings-group .section-heading { min-height: 52px; }
    .settings-group .setting-row, .settings-group .privacy-list { margin-inline: -12px; }
    .settings-group .setting-row { padding-inline: 16px; }
    .settings-group .privacy-list > div { padding-inline: 16px; }

    .admin-topbar__inner { width: 100%; padding-inline: 14px; flex-wrap: wrap; }
    .admin-nav { width: 100%; order: 3; overflow-x: auto; padding: 6px 0 8px; }
    .admin-nav a { white-space: nowrap; }
    .admin-topbar__tools { width: 100%; flex-wrap: wrap; gap: 8px; }
    .admin-nav { flex-basis: 100%; }
    .admin-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-overview > div { min-height: 78px; border-bottom: 1px solid var(--line); }
    .admin-overview > div:nth-child(2) { border-right: 0; }
    .admin-overview > div:nth-last-child(-n+2) { border-bottom: 0; }
    .theme-choice-grid { grid-template-columns: 1fr; }
}

@media (max-width: 380px) {
    .is-guest .topbar__inner, .is-guest .main { padding-inline: 16px; }
    .login-page { padding-top: 36px; }
    .login-hero h1 { font-size: 34px; }
    .login-school-name { font-size: 15px; }
    .login-information { margin-top: 24px; }
    .login-captcha { padding-inline: 10px; }
    .login-captcha__row { grid-template-columns: minmax(0, 1fr) 96px 34px; }
    .login-captcha__image { width: 96px; height: 40px; }
    .login-captcha__refresh { width: 34px; height: 34px; }
    .mobile-hero { gap: 10px; }
    .mobile-hero__content h1 { font-size: 23px; }
    .mobile-hero__content > span { font-size: 11px; }
    .mobile-hero__week { min-width: 88px; }
    .wechat-grid__item small { display: none; }
    .wechat-grid__item { min-height: 92px; }
    .week-range { display: none; }
}
