:root {
  --ink: #15221f;
  --evergreen: #173b35;
  --paper: #f7f8f3;
  --paper-deep: #edf1eb;
  --line: #d7dfd9;
  --muted: #64716c;
  --red: #a54638;
  --blue: #2f6173;
  --shadow: 0 14px 36px rgba(21, 34, 31, 0.1);
  font-family: "Microsoft YaHei UI", "PingFang SC", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { min-width: 320px; min-height: 100vh; margin: 0; background: var(--paper); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid rgba(47, 97, 115, 0.42); outline-offset: 2px; }
svg { width: 18px; height: 18px; flex: 0 0 auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.eyebrow { display: block; color: var(--muted); font-family: "Georgia", "STSong", "SimSun", serif; font-size: 11px; font-weight: 700; letter-spacing: 0.1em; }

/* Portal */
.portal-shell { min-height: 100vh; display: flex; flex-direction: column; background: var(--paper); }
.portal-header { border-bottom: 1px solid var(--line); background: rgba(247, 248, 243, 0.92); }
.portal-header__inner { width: min(1360px, calc(100% - 56px)); height: 72px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.school-mark { display: inline-flex; align-items: center; gap: 11px; min-width: 0; }
.school-mark__seal { width: 34px; height: 34px; display: inline-grid; place-items: center; border: 2px solid var(--red); color: var(--red); font-family: "STSong", "Songti SC", "SimSun", serif; font-size: 14px; font-weight: 700; letter-spacing: 1px; }
.school-mark b { display: block; font-family: "STSong", "Songti SC", "SimSun", serif; font-size: 17px; letter-spacing: 0; }
.school-mark small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.portal-actions, .topbar-actions { display: flex; align-items: center; gap: 10px; }
.portal-date { color: var(--muted); font-size: 13px; }
.icon-button { width: 34px; height: 34px; display: inline-grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--evergreen); }
.icon-button:hover { border-color: var(--evergreen); background: var(--paper-deep); }
.profile-button { min-height: 34px; display: inline-flex; align-items: center; gap: 7px; padding: 0 9px; border: 1px solid transparent; background: transparent; color: var(--ink); font-size: 13px; }
.profile-button:hover { border-color: var(--line); background: #fff; }
.portal-main { width: min(1360px, calc(100% - 56px)); flex: 1; margin: 0 auto; padding: 56px 0 42px; }
.portal-heading { display: flex; justify-content: space-between; align-items: end; gap: 28px; padding-bottom: 30px; border-bottom: 1px solid var(--line); }
.portal-heading h1 { margin: 7px 0 4px; color: var(--evergreen); font-family: "STSong", "Songti SC", "SimSun", serif; font-size: 38px; font-weight: 700; line-height: 1.1; }
.portal-heading p { margin: 0; color: var(--muted); font-size: 15px; }
.portal-summary { display: flex; gap: 24px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.portal-summary b { margin-right: 5px; color: var(--evergreen); font-family: "Georgia", serif; font-size: 20px; }
.portal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 26px 0; }
.filter-group { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-button { min-height: 32px; padding: 0 11px; border: 1px solid var(--line); border-radius: 4px; background: transparent; color: var(--muted); font-size: 13px; }
.filter-button:hover, .filter-button.is-active { border-color: var(--evergreen); background: var(--evergreen); color: #fff; }
.search-field { width: 240px; min-height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--muted); }
.search-field input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 13px; }
.system-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.system-card { min-height: 170px; display: grid; grid-template-columns: 42px minmax(0, 1fr) 20px; gap: 14px; align-items: start; padding: 22px 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, 0.68); transition: background 160ms ease, transform 160ms ease; }
.system-card[hidden] { display: none !important; }
.system-card:hover { background: #fff; transform: translateY(-2px); box-shadow: 0 10px 24px rgba(21, 34, 31, 0.06); }
.system-card__icon { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid color-mix(in srgb, var(--accent) 36%, #fff); border-radius: 6px; background: color-mix(in srgb, var(--accent) 9%, #fff); color: var(--accent); }
.system-card__content { display: grid; gap: 7px; min-width: 0; }
.system-card__content b { color: var(--evergreen); font-family: "STSong", "Songti SC", "SimSun", serif; font-size: 17px; line-height: 1.3; }
.system-card__content small { color: var(--muted); font-size: 12px; line-height: 1.6; }
.system-card__arrow { color: var(--muted); }
.system-code { width: max-content; display: inline-flex; align-items: center; min-height: 20px; padding: 0 5px; border: 1px solid currentColor; color: var(--red); font-family: "Georgia", "STSong", serif; font-size: 10px; font-weight: 700; letter-spacing: 0.05em; }
.empty-state { padding: 48px 0; color: var(--muted); text-align: center; }
.portal-footer { width: min(1360px, calc(100% - 56px)); display: flex; justify-content: space-between; gap: 18px; margin: auto auto 0; padding: 18px 0 25px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

/* Login */
.login-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(420px, 0.85fr); background: #fff; }
.login-visual { position: relative; min-height: 680px; overflow: hidden; color: #fff; }
.login-visual__image { position: absolute; inset: 0; background: url("campus-library.png") center / cover no-repeat; }
.login-visual::after { position: absolute; inset: 0; z-index: 0; background: rgba(15, 41, 35, 0.52); content: ""; }
.login-visual__content { position: relative; z-index: 1; height: 100%; min-height: inherit; display: flex; flex-direction: column; padding: 40px clamp(42px, 7vw, 112px); }
.visual-brand { display: inline-flex; align-items: center; gap: 10px; width: max-content; font-family: "STSong", "Songti SC", "SimSun", serif; font-size: 18px; font-weight: 700; }
.visual-copy { max-width: 450px; margin: auto 0; }
.visual-copy .system-code { border-color: rgba(255, 255, 255, 0.72); color: #fff; }
.visual-copy__english { margin: 18px 0 8px; font-family: Georgia, serif; font-size: 11px; font-weight: 700; letter-spacing: 0.16em; }
.visual-copy h1 { margin: 0; font-family: "STSong", "Songti SC", "SimSun", serif; font-size: 46px; line-height: 1.22; }
.visual-copy p:last-child { margin: 18px 0 0; color: rgba(255, 255, 255, 0.86); font-size: 16px; line-height: 1.75; }
.visual-footnote { display: flex; align-items: center; gap: 9px; color: rgba(255, 255, 255, 0.72); font-size: 12px; }
.visual-footnote span { width: 30px; height: 1px; background: currentColor; }
.login-panel { display: grid; place-items: center; min-width: 0; padding: 40px; background: var(--paper); }
.login-panel__inner { width: min(100%, 390px); }
.back-link { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; }
.back-link:hover { color: var(--evergreen); }
.login-heading { margin: 56px 0 34px; }
.login-heading h2 { margin: 9px 0 6px; color: var(--evergreen); font-family: "STSong", "Songti SC", "SimSun", serif; font-size: 32px; line-height: 1.2; }
.login-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.login-form { display: grid; gap: 22px; }
.field-group { display: grid; gap: 9px; }
.field-group label, .field-label-row { color: var(--ink); font-size: 13px; font-weight: 700; }
.field-label-row { display: flex; justify-content: space-between; align-items: center; }
.field-label-row a { color: var(--blue); font-size: 12px; font-weight: 400; }
.input-wrap { min-height: 46px; display: flex; align-items: center; gap: 10px; padding: 0 12px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--muted); }
.input-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 13%, transparent); }
.input-wrap input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 14px; }
.input-wrap input::placeholder { color: #98a39f; }
.input-icon-button { width: 30px; height: 30px; display: grid; place-items: center; padding: 0; border: 0; background: transparent; color: var(--muted); }
.input-icon-button:hover { color: var(--evergreen); }
.form-error { margin: -8px 0 -6px; color: #a54638; font-size: 12px; }
.primary-button { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 12px; padding: 0 18px; border: 1px solid var(--accent, var(--evergreen)); border-radius: 5px; background: var(--accent, var(--evergreen)); color: #fff; font-weight: 700; transition: background 160ms ease, border-color 160ms ease, transform 160ms ease; }
.primary-button:hover { background: var(--evergreen); border-color: var(--evergreen); transform: translateY(-1px); }
.login-note { display: flex; align-items: flex-start; gap: 8px; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.6; }
.login-note svg { width: 16px; height: 16px; color: var(--evergreen); }
.login-copyright { margin: 48px 0 0; color: #909a96; font-size: 11px; }

/* Dashboard */
.dashboard-shell { min-height: 100vh; background: var(--paper); }
.dashboard-topbar { height: 66px; display: grid; grid-template-columns: 260px minmax(0, 1fr) auto; align-items: center; gap: 18px; padding: 0 22px; border-bottom: 1px solid var(--line); background: #fff; }
.school-mark--compact .school-mark__seal { width: 30px; height: 30px; font-size: 12px; }
.school-mark--compact b { font-size: 15px; }
.topbar-system { min-width: 0; display: flex; align-items: center; gap: 9px; color: var(--evergreen); font-size: 14px; font-weight: 700; }
.topbar-system > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.environment-tag { padding: 3px 7px; border: 1px solid #e1c6bf; border-radius: 4px; background: #fff7f5; color: var(--red); font-size: 11px; white-space: nowrap; }
.dashboard-layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: calc(100vh - 66px); }
.side-nav { display: flex; flex-direction: column; min-width: 0; padding: 20px 12px 16px; border-right: 1px solid var(--line); background: #f1f4ef; }
.side-nav__head { display: flex; align-items: center; gap: 10px; padding: 7px 10px 20px; border-bottom: 1px solid var(--line); }
.side-nav__head > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 5px; background: color-mix(in srgb, var(--accent) 10%, #fff); color: var(--accent); }
.side-nav__head b { display: block; color: var(--evergreen); font-size: 13px; }
.side-nav__head small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.side-nav nav { display: grid; gap: 2px; margin-top: 16px; }
.side-nav__item { min-height: 39px; display: flex; align-items: center; gap: 10px; padding: 0 10px; border: 0; border-left: 2px solid transparent; border-radius: 0 4px 4px 0; background: transparent; color: #57645f; text-align: left; font-size: 13px; }
.side-nav__item:hover { background: #e7ece7; color: var(--evergreen); }
.side-nav__item.is-active { border-left-color: var(--accent); background: #fff; color: var(--evergreen); font-weight: 700; }
.side-nav__portal { display: flex; align-items: center; gap: 10px; min-height: 39px; margin-top: auto; padding: 0 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.side-nav__portal:hover { color: var(--evergreen); }
.dashboard-main { position: relative; min-width: 0; padding: 36px 40px 56px; background: var(--paper); }
.content-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.content-heading h1 { margin: 8px 0 6px; color: var(--evergreen); font-family: "STSong", "Songti SC", "SimSun", serif; font-size: 29px; line-height: 1.2; }
.content-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.content-heading__actions { display: flex; align-items: center; gap: 16px; }
.content-date { color: var(--muted); font-size: 12px; white-space: nowrap; }
.primary-button--compact { min-height: 38px; padding: 0 13px; font-size: 13px; }
.primary-button--compact svg { width: 16px; height: 16px; }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 28px 0; }
.metric-block { min-height: 126px; padding: 18px; border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 6px; background: #fff; }
.metric-block--1 { border-top-color: var(--blue); }
.metric-block--2 { border-top-color: var(--red); }
.metric-block p, .metric-block small { margin: 0; color: var(--muted); font-size: 12px; }
.metric-block strong { display: block; margin: 11px 0 8px; color: var(--evergreen); font-family: Georgia, "STSong", serif; font-size: 28px; line-height: 1; }
.work-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(290px, 0.38fr); gap: 20px; align-items: start; }
.data-section, .task-section { min-width: 0; border-top: 2px solid var(--evergreen); background: rgba(255, 255, 255, 0.84); }
.section-heading { min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.section-heading h2 { margin: 0; color: var(--evergreen); font-family: "STSong", "Songti SC", "SimSun", serif; font-size: 18px; }
.section-heading p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.section-heading > svg { color: var(--accent); }
.text-button { display: inline-flex; align-items: center; gap: 5px; padding: 0; border: 0; background: transparent; color: var(--blue); font-size: 12px; white-space: nowrap; }
.text-button:hover { color: var(--evergreen); }
.text-button svg { width: 15px; height: 15px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; min-width: 520px; border-collapse: collapse; font-size: 13px; }
th, td { padding: 15px 20px; border-bottom: 1px solid #e7ece8; text-align: left; white-space: nowrap; }
th { color: #64716c; background: #f5f7f4; font-size: 12px; font-weight: 700; }
td { color: #35433d; }
tbody tr:hover { background: #f8faf7; }
.status { display: inline-flex; min-height: 22px; align-items: center; padding: 0 7px; border-radius: 3px; font-size: 11px; }
.status-good { background: #edf6ef; color: #327343; }
.status-warn { background: #fff4ed; color: #9a552e; }
.status-neutral { background: #eef3f4; color: #47616c; }
.task-section { border-top-color: var(--accent); }
.task-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.task-list li { display: grid; grid-template-columns: 7px minmax(0, 1fr) 16px; gap: 10px; align-items: center; min-height: 70px; padding: 12px 18px; border-bottom: 1px solid #e7ece8; color: var(--muted); }
.task-list li:hover { background: #f8faf7; }
.task-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.task-list b { display: block; color: #35433d; font-size: 13px; }
.task-list small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.task-list svg { width: 16px; height: 16px; color: #93a09a; }
.toast { position: fixed; right: 28px; bottom: 28px; max-width: calc(100vw - 56px); padding: 12px 16px; border-left: 3px solid var(--accent); background: var(--evergreen); box-shadow: var(--shadow); color: #fff; font-size: 13px; }

@media (max-width: 1200px) {
  .system-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .work-grid { grid-template-columns: minmax(0, 1fr) 310px; }
  .dashboard-main { padding: 32px 28px 48px; }
}

@media (max-width: 960px) {
  .portal-header__inner, .portal-main, .portal-footer { width: min(100% - 36px, 1360px); }
  .system-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-screen { grid-template-columns: 1fr; }
  .login-visual { min-height: 350px; }
  .login-visual__content { min-height: 350px; padding: 28px 34px; }
  .visual-copy { margin: auto 0 26px; }
  .visual-copy h1 { font-size: 38px; }
  .login-panel { padding: 44px 28px; }
  .dashboard-topbar { grid-template-columns: 220px minmax(0, 1fr) auto; padding: 0 14px; }
  .dashboard-layout { grid-template-columns: 200px minmax(0, 1fr); }
  .side-nav { padding: 16px 9px; }
  .side-nav__item { padding: 0 8px; font-size: 12px; }
  .work-grid { grid-template-columns: 1fr; }
  .task-section { min-width: 0; }
}

@media (max-width: 680px) {
  .portal-header__inner { height: 64px; }
  .portal-date, .profile-button span, .school-mark small { display: none; }
  .portal-main { padding-top: 34px; }
  .portal-heading { display: block; }
  .portal-heading h1 { font-size: 32px; }
  .portal-summary { margin-top: 20px; gap: 18px; }
  .portal-toolbar { display: grid; gap: 16px; }
  .search-field { width: 100%; }
  .system-grid { grid-template-columns: 1fr; }
  .system-card { min-height: 132px; }
  .portal-footer { display: block; line-height: 1.9; }
  .login-visual, .login-visual__content { min-height: 300px; }
  .login-visual__content { padding: 24px; }
  .visual-copy { margin-bottom: 18px; }
  .visual-copy h1 { font-size: 32px; }
  .visual-copy p:last-child { margin-top: 10px; font-size: 14px; }
  .login-panel { padding: 36px 22px; }
  .login-heading { margin: 38px 0 30px; }
  .dashboard-topbar { height: auto; min-height: 60px; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 9px 12px; }
  .dashboard-topbar .school-mark--compact b { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-system { display: none; }
  .environment-tag { display: none; }
  .topbar-actions { gap: 5px; }
  .dashboard-layout { display: block; min-height: 0; }
  .side-nav { display: block; padding: 0; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; white-space: nowrap; }
  .side-nav__head, .side-nav__portal { display: none; }
  .side-nav nav { display: flex; gap: 0; margin: 0; min-width: max-content; }
  .side-nav__item { min-height: 45px; border-left: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 0 12px; }
  .side-nav__item.is-active { border-left: 0; border-bottom-color: var(--accent); }
  .dashboard-main { padding: 26px 16px 42px; }
  .content-heading { display: block; padding-bottom: 20px; }
  .content-heading h1 { font-size: 26px; }
  .content-heading__actions { justify-content: space-between; margin-top: 18px; }
  .metric-grid { grid-template-columns: 1fr; gap: 9px; margin: 20px 0; }
  .metric-block { min-height: 104px; }
  .section-heading { min-height: 76px; padding: 15px; }
  .table-scroll { overflow-x: visible; }
  table { min-width: 0; table-layout: fixed; font-size: 11px; }
  th, td { padding: 12px 9px; white-space: normal; overflow-wrap: anywhere; }
  .toast { right: 16px; bottom: 16px; max-width: calc(100vw - 32px); }
}
