:root {
  --ink: #12325f;
  --forest: #2c73d2;
  --forest-dark: #0043b0;
  --cream: #edf6ff;
  --paper: #fbfdff;
  --orange: #538def;
  --line: #cbdcf1;
  --muted: #607593;
  --danger: #a63a2e;
  --number-font: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-width: 0; max-width: 100%; overflow-x: hidden; overflow-x: clip; -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; margin: 0; color: var(--ink); font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif; background: linear-gradient(135deg, #edf6ff 0%, #f9fcff 46%, #e7f3ff 100%); }
button, input, select { font: inherit; }
button { max-width: 100%; cursor: pointer; }
button:not(.admin-menu-card):not(.department-stat):not(.page-back-button):not(.badge-distribution-group-toggle) { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
[hidden] { display: none !important; }
.eyebrow, .kicker { margin: 0 0 10px; color: var(--orange); font-size: 11px; font-weight: 900; letter-spacing: .2em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

.login-view { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: linear-gradient(90deg, #edf6ff 0 50%, #2c73d2 50% 76%, #0043b0 100%); }
.login-brand { padding: clamp(40px, 8vw, 110px); display: flex; flex-direction: column; justify-content: center; color: var(--ink); background: transparent; }
.login-mascot { width: min(330px, 76%); max-height: 300px; margin: 14px auto 28px; display: block; object-fit: contain; border: 0; outline: 0; color: transparent; background: transparent; box-shadow: none; filter: none; }
.login-brand .eyebrow { margin-top: auto; }
.login-brand h1 { margin: 0; font: 700 clamp(48px, 6vw, 78px)/1.15 "STSong", "SimSun", serif; letter-spacing: -.04em; }
.login-brand h1 span, .login-brand h1 em { display: block; white-space: nowrap; }
.login-brand h1 em { color: #2c73d2; font-style: normal; }
.login-brand > p:last-child { max-width: none; margin: 28px 0 auto; color: var(--muted); line-height: 1.9; white-space: nowrap; }
.back-link { margin-bottom: auto; color: var(--forest-dark); font-size: 13px; text-decoration: none; }
.back-link:hover { color: var(--forest); }
.login-card { width: min(440px, calc(100% - 48px)); margin: auto; padding: 46px; position: relative; border-top: 5px solid var(--orange); border-radius: 4px 4px 24px 4px; background: var(--paper); box-shadow: 0 28px 80px rgba(0,67,176,.18); }
.seal { position: absolute; top: 38px; right: 42px; width: 50px; height: 50px; display: grid; place-items: center; border: 2px solid var(--orange); color: var(--orange); font: 26px "STKaiti", serif; transform: rotate(5deg); }
.login-card h2, .edit-card h2 { margin: 0 0 34px; font: 700 34px "STSong", "SimSun", serif; }
label { display: grid; gap: 9px; margin-bottom: 20px; }
label > span { font-size: 13px; font-weight: 800; }
input, select, textarea { width: 100%; min-width: 0; max-width: 100%; padding: 0 15px; border: 1px solid var(--line); border-radius: 4px; outline: none; color: var(--ink); background: #f5f9ff; font: inherit; }
input, select { height: 50px; }
#application-edit-file { padding-top: 0; padding-bottom: 0; line-height: 48px; }
#application-edit-file::file-selector-button { height: 100%; margin: 0 10px 0 -15px; padding: 0 14px; border: 0; border-right: 1px solid var(--line); color: var(--ink); background: #edf4fc; vertical-align: middle; }
input[type="date"], input[type="datetime-local"], input[type="time"] {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  inline-size: 100%;
  min-inline-size: 0;
  max-inline-size: 100%;
  -webkit-appearance: none;
  appearance: none;
  padding-top: 0;
  padding-bottom: 0;
  line-height: 1.2;
}
input[type="date"]::-webkit-date-and-time-value,
input[type="datetime-local"]::-webkit-date-and-time-value,
input[type="time"]::-webkit-date-and-time-value { width: 100%; min-width: 0; height: 100%; margin: 0; display: flex; align-items: center; text-align: left; line-height: normal; }
input[type="date"]::-webkit-datetime-edit,
input[type="datetime-local"]::-webkit-datetime-edit,
input[type="time"]::-webkit-datetime-edit { width: 100%; min-width: 0; height: 100%; padding: 0; display: flex; align-items: center; overflow: hidden; line-height: normal; }
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator { align-self: center; margin-top: 0; margin-bottom: 0; }
textarea { padding-top: 12px; padding-bottom: 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--forest); box-shadow: 0 0 0 4px rgba(83,141,239,.16); background: white; }
.login-card form > button, #save-button { width: 100%; height: 54px; padding: 0 20px; display: flex; justify-content: space-between; align-items: center; border: 0; border-radius: 4px; background: var(--forest); color: white; font-weight: 800; }
.login-card form > button:hover, #save-button:hover { background: var(--forest-dark); }
.form-error { min-height: 20px; margin: -4px 0 12px; color: var(--danger); font-size: 12px; }

.dashboard { width: min(1440px, calc(100% - 48px)); min-width: 0; max-width: 100%; margin: 0 auto; padding: 36px 0 70px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 30px; }
.topbar-brand { display: flex; align-items: center; gap: 18px; }
.topbar-mascot { width: 108px; height: 82px; display: block; object-fit: contain; border: 0; outline: 0; color: transparent; background: transparent; box-shadow: none; filter: none; }
.topbar h1 { margin: 0; font: 700 38px "STSong", "SimSun", serif; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.scope-badge { padding: 8px 11px; border-radius: 20px; color: var(--forest-dark); background: #dcecff; font-size: 11px; font-weight: 800; }
.live-state { margin-right: 8px; color: var(--muted); font-size: 12px; }
.live-state i { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; background: #538def; box-shadow: 0 0 0 4px rgba(83,141,239,.16); }
.live-state.error i { background: var(--danger); }
.sync-time { color: var(--muted); font-size: 11px; white-space: nowrap; }
.sync-time b { margin-left: 4px; color: var(--forest); }
.quiet-button { height: 40px; padding: 0 16px; border: 1px solid #cfc9bb; border-radius: 4px; color: var(--ink); background: transparent; }
.quiet-button:hover { border-color: var(--forest); background: white; }
.danger-button { min-height: 38px; padding: 0 15px; border: 0; border-radius: 4px; color: white; background: var(--danger); font-weight: 800; }
.danger-button:hover { background: #812c23; }
.danger-button:disabled { opacity: .45; cursor: not-allowed; }
.delete-warning { margin: 0 0 18px; color: var(--danger); font-size: 13px; font-weight: 800; }

.summary { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(120px, .78fr) minmax(310px, 1.35fr) minmax(140px, 1fr); gap: 14px; margin-bottom: 18px; }
.summary article { min-width: 0; min-height: 126px; padding: 22px; overflow: hidden; border: 1px solid #e1dccf; background: rgba(255,253,248,.72); }
.summary article:first-child { border-top: 4px solid var(--orange); }
.summary span { display: block; margin-bottom: 12px; color: var(--muted); font-size: 12px; font-weight: 700; }
.summary strong { font: 700 30px/1 var(--number-font); font-variant-numeric: tabular-nums; }
.summary small { margin-left: 5px; color: var(--muted); }
.badge-summary-card .badge-breakdown { display: flex; align-items: baseline; gap: 7px; white-space: nowrap; }
.badge-summary-card .badge-breakdown b { color: var(--ink); font: 700 30px/1 var(--number-font); font-variant-numeric: tabular-nums; }
.badge-summary-card .badge-breakdown b:last-of-type { color: var(--forest); }
.badge-summary-card .badge-breakdown i { color: #b7b0a3; font: 400 30px/1 var(--number-font); }
.badge-summary-card > small { display: block; margin: 6px 0 0; font-size: 10px; }
.badge-distribution-panel { margin-bottom: 18px; padding: 26px 28px 28px; border: 1px solid #d3e3f5; border-top: 4px solid var(--orange); background: rgba(251,253,255,.92); box-shadow: 0 18px 54px rgba(0,67,176,.08); }
.badge-distribution-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 20px; }
.badge-distribution-heading h2 { margin: 0; font: 700 27px "STSong", "SimSun", serif; }
.badge-distribution-heading > div > p:last-child { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.badge-distribution-insight { max-width: 420px; margin: 0; padding: 10px 14px; border-radius: 8px; color: #0043b0; background: #e5f0ff; font-size: 12px; font-weight: 800; line-height: 1.6; }
.badge-distribution-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 22px; }
.badge-distribution-metrics article { min-width: 0; padding: 14px 16px; border-left: 3px solid #74a8ff; background: #f3f8ff; }
.badge-distribution-metrics span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 700; }
.badge-distribution-metrics b { color: var(--ink); font: 800 25px/1 var(--number-font); font-variant-numeric: tabular-nums; }
.badge-distribution-metrics small { margin-left: 4px; color: var(--muted); font-size: 11px; }
.badge-distribution-chart { display: grid; gap: 9px; }
.badge-distribution-row { min-width: 0; display: grid; grid-template-columns: 72px minmax(120px, 1fr) 116px; align-items: center; gap: 12px; }
.badge-distribution-group { display: grid; gap: 7px; }
button.badge-distribution-group-toggle { width: 100%; max-width: none; padding: 0; overflow: visible; border: 0; color: inherit; background: transparent; text-align: inherit; white-space: normal; text-overflow: clip; }
button.badge-distribution-group-toggle:hover .badge-distribution-track { background: #d9e9fb; }
button.badge-distribution-group-toggle:focus-visible { outline: 2px solid #538def; outline-offset: 4px; border-radius: 4px; }
.badge-distribution-children { display: grid; gap: 7px; margin: 0 0 3px 20px; padding: 9px 0 9px 14px; border-left: 2px solid #b8d5f6; background: linear-gradient(90deg, rgba(229,240,255,.7), transparent 70%); }
.badge-distribution-child-row .badge-distribution-label { color: var(--muted); }
.badge-distribution-child-row .badge-distribution-track { height: 14px; background: #edf4fc; }
.badge-distribution-child-row .badge-distribution-fill { background: linear-gradient(90deg, #9bc2ff, #538def); }
.badge-distribution-child-row .badge-distribution-count strong { font-size: 14px; }
.badge-distribution-label { color: var(--ink); font-size: 12px; font-weight: 800; text-align: right; white-space: nowrap; }
.badge-distribution-track { height: 18px; overflow: hidden; border-radius: 9px; background: #e7f0fb; }
.badge-distribution-fill { width: var(--bar-width, 0%); height: 100%; display: block; border-radius: inherit; background: linear-gradient(90deg, #74a8ff, #1768d4); transition: width .3s ease; }
.badge-distribution-count { color: var(--muted); font-size: 11px; white-space: nowrap; }
.badge-distribution-count strong { margin-right: 3px; color: #1768d4; font: 800 16px/1 var(--number-font); }
.badge-distribution-count small { margin-left: 6px; color: #7e8fa8; }
.badge-distribution-empty { padding: 30px; color: var(--muted); background: #f3f8ff; text-align: center; font-size: 13px; }
.admin-menu { display: grid; gap: 14px; margin-bottom: 18px; }
.admin-menu-card { width: 100%; min-height: 118px; padding: 24px 28px; display: grid; grid-template-columns: 58px minmax(0, 1fr) auto 28px; align-items: center; gap: 22px; text-align: left; border: 1px solid #ddd7ca; border-left: 5px solid var(--forest); border-radius: 5px 5px 18px 5px; color: var(--ink); background: var(--paper); box-shadow: 0 14px 40px rgba(23,53,45,.05); transition: transform .18s, border-color .18s, box-shadow .18s; }
.admin-menu-card:hover { transform: translateY(-2px); border-color: #aebfb8; box-shadow: 0 20px 50px rgba(23,53,45,.11); }
.admin-menu-card:nth-child(1) { border-left-color: var(--orange); }
.admin-menu-number { color: #b7b0a3; font: 700 24px/1 var(--number-font); font-variant-numeric: tabular-nums; }
.admin-menu-copy b, .admin-menu-copy small { display: block; }
.admin-menu-copy b { margin-bottom: 9px; font: 700 27px "STSong", "SimSun", serif; }
.admin-menu-copy small { color: var(--muted); font-size: 12px; line-height: 1.7; }
.admin-menu-status { padding: 8px 13px; border-radius: 20px; color: #8b5a12; background: #fff0cb; font-size: 11px; font-weight: 800; white-space: nowrap; }
.admin-menu-status strong { margin: 0 3px; font-size: 16px; }
.admin-menu-arrow { color: var(--forest); font-size: 24px; }
.level-one-page-heading { margin-bottom: 18px; padding: 22px 28px; display: flex; align-items: center; gap: 26px; border: 1px solid #dcd6c9; border-top: 4px solid var(--orange); background: rgba(255,253,248,.78); }
.level-one-page-heading h2 { margin: 0; font: 700 30px "STSong", "SimSun", serif; }
.level-one-page-heading p:last-child { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.level-one-page-heading p strong { color: var(--orange); font-size: 17px; }
.data-page-heading-copy { flex: 1; min-width: min(260px, 100%); }
.data-page-actions { width: 100%; min-width: 0; margin-left: auto; display: grid; gap: 10px; justify-items: stretch; }
.data-page-controls { width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; align-items: end; }
.data-page-controls.department-filter-hidden { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.data-page-controls label { min-width: 0; margin: 0; gap: 6px; }
.data-page-controls .filter-control { width: 100%; }
.data-page-controls select, .data-page-controls input { width: 100%; height: 42px; }
.data-page-entry-buttons { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.archive-page-entry { min-height: 42px; padding: 0 18px; border: 0; border-radius: 12px; color: #fff; background: #1768d4; cursor: pointer; font-weight: 700; }
.analytics-page-heading .data-page-heading-copy { min-width: 0; }
.analytics-filter-panel { margin-bottom: 18px; padding: 20px 28px 22px; border: 1px solid #d3e3f5; border-radius: 6px; background: rgba(251,253,255,.9); box-shadow: 0 14px 42px rgba(0,67,176,.07); }
.analytics-filter-heading { margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.analytics-filter-heading b, .analytics-filter-heading small { display: block; }
.analytics-filter-heading b { margin-bottom: 5px; font-size: 15px; }
.analytics-filter-heading small, .analytics-filter-panel > p { color: var(--muted); font-size: 11px; }
.analytics-filter-heading .quiet-button { flex: 0 0 auto; }
.analytics-filter-controls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.analytics-filter-controls label { min-width: 0; margin: 0; gap: 6px; }
.analytics-filter-controls label > span { color: var(--muted); font-size: 10px; }
.analytics-filter-controls input, .analytics-filter-controls select { height: 42px; }
.analytics-roster-filter-control { margin-top: 16px; padding-top: 16px; border-top: 1px solid #dbe8f7; }
.analytics-filter-panel > p { margin: 12px 0 0; }
#start-date-filter, #end-date-filter { padding-top: 0; padding-bottom: 0; line-height: 40px; }
#start-date-filter::-webkit-date-and-time-value,
#end-date-filter::-webkit-date-and-time-value { height: 40px; display: flex; align-items: center; line-height: 40px; }
#start-date-filter::-webkit-datetime-edit,
#end-date-filter::-webkit-datetime-edit { height: 40px; display: flex; align-items: center; padding: 0; line-height: 40px; }
.data-global-search { width: auto; margin: 0; gap: 6px; }
.data-global-search { grid-column: 1 / -1; }
.data-global-search > span:first-child { color: var(--muted); font-size: 10px; }
.data-global-search .search-box { width: 100%; }
.data-global-search .search-box i { color: var(--muted); font-style: normal; }
.data-global-search input { height: 42px; }
.roster-filter-control { grid-column: 1 / -1; min-width: 0; display: grid; grid-template-columns: minmax(240px, 1fr) auto auto auto; gap: 8px; align-items: center; }
.roster-filter-label { grid-column: 1 / -1; color: var(--muted); font-size: 10px; }
.roster-filter-control input[type="file"] { height: 42px; padding: 7px; background: #faf8f2; font-size: 12px; }
@supports (-webkit-touch-callout: none) {
  .roster-filter-control input[type="file"] { position: relative; top: 2px; }
}
.roster-filter-control button { height: 42px; padding: 0 14px; border: 0; border-radius: 4px; color: white; background: var(--forest); font-weight: 800; white-space: nowrap; }
.roster-filter-control .quiet-filter-button { border: 1px solid #cfc9bb; color: var(--forest); background: white; }
.roster-filter-control a { color: #1768d4; font-size: 11px; font-weight: 800; white-space: nowrap; }
.roster-filter-control small { grid-column: 1 / -1; color: var(--muted); font-size: 10px; }
.roster-filter-control small.active { color: var(--forest); font-weight: 800; }
.roster-filter-control small.error { color: var(--danger); white-space: pre-line; line-height: 1.7; }
.page-back-button { width: max-content; min-width: 150px; max-width: none; height: 42px; padding: 0 18px; flex: 0 0 auto; overflow: visible; border: 1px solid #cfc9bb; border-radius: 4px; color: var(--forest); background: white; font-weight: 800; white-space: nowrap; text-overflow: clip; }
.page-back-button:hover { border-color: var(--forest); background: #eef4f1; }

.student-upload-panel { margin-bottom: 18px; padding: 22px 28px; display: grid; grid-template-columns: minmax(230px, .7fr) minmax(420px, 1.3fr); gap: 28px; align-items: center; border: 1px solid #dfdacd; border-left: 5px solid var(--orange); background: var(--paper); }
.student-upload-panel h2 { margin: 0; font: 700 25px "STSong", "SimSun", serif; }
.student-upload-panel > div > p:last-child { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.student-upload-panel form { min-width: 0; display: grid; grid-template-columns: minmax(260px, 1fr) auto; gap: 10px; align-items: end; }
.student-upload-panel label { min-width: 0; margin: 0; gap: 5px; }
.student-upload-panel input[type="file"] { height: 44px; padding: 8px; background: #faf8f2; font-size: 12px; }
.student-upload-panel button { height: 44px; padding: 0 20px; border: 0; border-radius: 4px; color: white; background: var(--forest); font-weight: 800; white-space: nowrap; }
.student-upload-panel button:hover { background: var(--forest-dark); }
.student-upload-panel button:disabled { opacity: .55; cursor: wait; }
.student-upload-message { grid-column: 1 / -1; min-height: 17px; margin: 0; color: var(--forest); font-size: 11px; }
.student-upload-message.error { color: var(--danger); }

.student-directory-panel { margin-bottom: 18px; overflow: hidden; border: 1px solid #dfdacd; background: var(--paper); }
.student-directory-heading { padding: 22px 28px; display: flex; align-items: end; justify-content: space-between; gap: 24px; border-bottom: 1px solid #e8e2d7; }
.student-directory-heading h2 { margin: 0; font: 700 25px "STSong", "SimSun", serif; }
.student-directory-heading > div > p:last-child { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.student-directory-heading > div > p b { color: var(--forest); font-size: 15px; }
.student-directory-search { width: min(300px, 100%); margin: 0; gap: 5px; }
.student-directory-search > span { color: var(--muted); font-size: 10px; }
.student-directory-search input { height: 42px; background: #faf8f2; }
.student-directory-message { display: none; margin: 14px 28px 0; padding: 10px 13px; color: var(--danger); background: #fbece9; font-size: 12px; }
.student-directory-message:not(:empty) { display: block; }
.student-directory-table-wrap { max-height: 430px; overflow: auto; }
.student-directory-table { min-width: 680px; }
.student-directory-table thead { position: sticky; z-index: 1; top: 0; }
.student-directory-table th, .student-directory-table td { width: auto; }
.student-directory-table td:nth-child(2) { color: var(--forest); font-family: Consolas, monospace; font-weight: 700; }
.student-batch-toolbar { border-top: 1px solid #e5dfd3; }
.support-qq-form { padding: 20px 28px 24px; display: grid; grid-template-columns: minmax(240px, 420px) auto; gap: 10px; align-items: end; }
.support-qq-form label { margin: 0; gap: 5px; }
.support-qq-form label span { color: var(--muted); font-size: 11px; }
.support-qq-form input { height: 44px; }
.support-qq-form button { height: 44px; padding: 0 18px; border: 0; border-radius: 4px; color: white; background: var(--forest); font-weight: 800; }
.support-qq-form p { grid-column: 1 / -1; min-height: 16px; margin: 0; color: var(--forest); font-size: 11px; }
.support-qq-form p.error { color: var(--danger); }
.account-form { padding: 20px 28px; display: grid; grid-template-columns: repeat(4,minmax(150px,1fr)) auto; gap: 10px; align-items: end; border-bottom: 1px solid #e8e2d7; }
.account-form label { margin: 0; gap: 5px; }
.account-form label span { color: var(--muted); font-size: 11px; }
.account-form input, .account-form select { height: 44px; }
.account-form button { height: 44px; padding: 0 18px; border: 0; border-radius: 4px; color: white; background: var(--forest); font-weight: 800; }
.account-form > p { grid-column: 1 / -1; min-height: 16px; margin: 0; color: var(--danger); font-size: 11px; }
.admin-account-list { padding: 18px 28px 26px; display: grid; gap: 12px; }
.admin-account-group { overflow: hidden; border: 1px solid #e0dacd; border-radius: 6px 6px 16px 6px; background: white; }
.admin-account-group-heading { min-height: 76px; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid #e8e2d7; background: #f7f4ed; }
.admin-account-group-heading h3 { margin: 0; font: 700 20px "STSong", "SimSun", serif; }
.admin-account-group-heading p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.admin-account-group-heading > span { flex: 0 0 auto; padding: 6px 10px; border-radius: 18px; color: var(--forest); background: #e2eee9; font-size: 11px; font-weight: 800; }
.admin-account-group-body { padding: 14px; display: grid; gap: 10px; }
.admin-account-departments { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); background: #f6f9fd; }
.admin-account-item { padding: 18px; display: grid; grid-template-columns: minmax(150px,1.1fr) minmax(230px,1.45fr) minmax(130px,.9fr) minmax(160px,1.2fr) auto; gap: 12px; align-items: end; border: 1px solid #e4ded2; background: #faf8f2; }
.admin-account-item.is-readonly { background: #f1f0ec; }
.admin-account-item.is-readonly input, .admin-account-item.is-readonly select { color: #7c8581; background: #e9e7e1; }
.admin-account-item label { margin: 0; gap: 5px; }
.admin-account-item label > span:first-child { color: var(--muted); font-size: 12px; }
.admin-account-item input, .admin-account-item select { height: 44px; font-size: 15px; }
.admin-account-item button { height: 40px; padding: 0 14px; border: 0; border-radius: 4px; color: white; background: var(--forest); font-weight: 800; }
.admin-account-item button:disabled { color: var(--muted); background: #d9d7d0; cursor: not-allowed; }
.account-actions { display: flex; gap: 8px; }
.admin-account-item .account-actions button { height: 44px; }
.admin-account-item .account-delete { border: 1px solid #d9a6a0; color: var(--danger); background: white; }
.password-field { position: relative; min-width: 0; display: block; }
.password-field input { width: 100%; padding-right: 44px; }
.password-field .password-toggle { position: absolute; top: 0; right: 0; width: 42px; height: 100%; padding: 0; border: 0; color: var(--forest); background: transparent; font-size: 18px; line-height: 1; }
.password-field .password-toggle img { width: 22px; height: 22px; display: block; margin: auto; object-fit: contain; }
.password-field .password-toggle:hover,
.password-field .password-toggle:focus,
.password-field .password-toggle:focus-visible { outline: none; background: transparent; box-shadow: none; -webkit-tap-highlight-color: transparent; }
.password-field .password-toggle:hover img { opacity: .72; }
.password-field .password-toggle:active img { transform: scale(.92); }
.account-department-card { min-height: 108px; }
.account-department-card small { color: var(--orange); }
.edit-card.department-account-card { width: min(1120px, calc(100% - 32px)); }
.department-account-list { display: grid; gap: 10px; }
.records-pagination { padding: 16px 22px; display: flex; justify-content: center; align-items: center; gap: 18px; border-top: 1px solid #e8e2d7; background: #faf8f2; }
.records-pagination span { color: var(--muted); font-size: 12px; }
.records-pagination b { color: var(--forest); }
.records-pagination button { height: 38px; padding: 0 15px; border: 1px solid #cfc9bb; border-radius: 4px; color: var(--forest); background: white; font-weight: 800; }
.records-pagination button:hover:not(:disabled) { border-color: var(--forest); background: #eef4f1; }
.records-pagination button:disabled { opacity: .4; cursor: not-allowed; }

.permission-panel { margin-bottom: 18px; overflow: hidden; border: 1px solid #dfdacd; background: var(--paper); }
.permission-heading { padding: 22px 28px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid #e8e2d7; }
.permission-heading h2 { margin: 0; font: 700 25px "STSong", "SimSun", serif; }
.permission-heading p:last-child { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.permission-list { padding: 14px 28px 22px; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.permission-item { min-height: 68px; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid #e4ded2; background: #faf8f2; }
.permission-item b, .permission-item small { display: block; }
.permission-item small { margin-top: 4px; color: var(--muted); }
.permission-toggle { min-width: 72px; height: 36px; padding: 0 12px; border: 1px solid #cfc9bb; border-radius: 18px; color: var(--muted); background: white; font-weight: 800; }
.permission-toggle.enabled { border-color: var(--forest); color: white; background: var(--forest); }
.permission-toggle:disabled { opacity: .55; cursor: wait; }

.staff-badge-panel { margin-bottom: 18px; overflow: hidden; border: 1px solid #dfdacd; border-radius: 5px; background: var(--paper); box-shadow: 0 20px 60px rgba(23,53,45,.07); }
.badge-overview-panel { width: 100%; min-width: 0; max-width: 100%; display: none; margin-bottom: 18px; overflow: hidden; contain: inline-size; border: 1px solid #cfdff2; border-radius: 7px 7px 22px 7px; background: var(--paper); box-shadow: 0 24px 70px rgba(0,67,176,.10); }
.badge-overview-panel:has(> section:not([hidden])) { display: block; }
.badge-overview-heading { padding: 24px 28px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid #dbe8f7; background: #f3f8ff; }
.badge-overview-heading h2 { margin: 0; font: 700 30px "STSong", "SimSun", serif; }
.badge-overview-heading .export-button { width: auto; margin-left: auto; }
.badge-overview-panel > .staff-badge-panel,
.badge-overview-panel > .data-panel { margin: 0; border: 0; border-radius: 0; box-shadow: none; }
.badge-overview-panel > .staff-badge-panel:not([hidden]) + .data-panel:not([hidden]) { border-top: 8px solid #edf4fc; }
.staff-badge-heading { padding: 24px 28px; display: flex; align-items: end; justify-content: space-between; gap: 24px; border-bottom: 1px solid #e8e2d7; }
.staff-badge-heading h2 { margin: 0; font: 700 27px "STSong", "SimSun", serif; }
.staff-badge-heading > div > p:last-child { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.staff-badge-heading > div > p b { color: var(--forest); font-size: 15px; }
.staff-badge-form { padding: 20px 28px; display: grid; grid-template-columns: 1.4fr 1fr 1fr .7fr auto; gap: 12px; align-items: end; border-bottom: 1px solid #e8e2d7; background: #f8f5ed; }
.staff-badge-form label { min-width: 0; margin: 0; gap: 5px; }
.staff-badge-form input, .staff-badge-form select { height: 44px; }
.staff-badge-form input[readonly] { color: var(--forest); font-weight: 800; }
.staff-badge-form button { height: 44px; padding: 0 18px; border: 0; border-radius: 4px; color: white; background: var(--forest); font-weight: 800; white-space: nowrap; }
.staff-badge-form button:hover { background: var(--forest-dark); }
.staff-badge-form button:disabled { opacity: .55; cursor: wait; }
.staff-badge-form .form-error { grid-column: 1 / -1; min-height: 17px; margin: 0; }
.staff-badge-import { padding: 18px 28px; display: grid; grid-template-columns: 220px 1fr; gap: 20px; border-bottom: 1px solid #e8e2d7; background: #eef4f1; }
.staff-badge-import-copy b, .staff-badge-import-copy span, .staff-badge-import-copy a { display: block; }
.staff-badge-import-copy span { margin: 7px 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.staff-badge-import-copy a { color: var(--forest); font-size: 12px; font-weight: 800; }
.staff-badge-import form { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 12px; align-items: end; }
.staff-badge-import label { min-width: 0; margin: 0; gap: 5px; }
.staff-badge-import input, .staff-badge-import select { height: 44px; }
.staff-badge-import input[type="file"] { padding: 8px; background: white; font-size: 12px; }
.staff-badge-import button { height: 44px; padding: 0 18px; border: 0; border-radius: 4px; color: white; background: var(--forest); font-weight: 800; white-space: nowrap; }
.staff-badge-import button:disabled { opacity: .5; cursor: not-allowed; }
.import-result { grid-column: 1 / -1; font-size: 12px; }
.import-result.error { padding: 12px 14px; color: var(--danger); background: #fbece9; }
.import-result.success { color: var(--forest); }
.import-result ol { max-height: 190px; margin: 8px 0 0; padding-left: 24px; overflow: auto; line-height: 1.7; }
.staff-badge-table-wrap { max-height: 430px; overflow: auto; }
.staff-badge-table { min-width: 1120px; }
.staff-badge-table thead { position: sticky; z-index: 1; top: 0; }
.staff-badge-table .staff-badge-value { color: var(--forest); font-weight: 800; }

.application-panel { margin-bottom: 18px; overflow: hidden; border: 1px solid #dfdacd; border-radius: 5px 5px 20px 5px; background: var(--paper); box-shadow: 0 20px 60px rgba(23,53,45,.07); }
.application-heading { padding: 25px 28px; display: flex; justify-content: space-between; gap: 22px; align-items: center; border-bottom: 1px solid #e8e2d7; }
.application-heading h2 { margin: 0; font: 700 27px "STSong", "SimSun", serif; }
.application-heading > div > p:last-child { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.application-counts { display: flex; gap: 9px; flex-wrap: wrap; }
.application-counts span { padding: 8px 11px; border-radius: 18px; color: var(--muted); background: #f1eee6; font-size: 11px; }
.application-counts b { margin-left: 4px; color: var(--forest); }
.application-form { min-width: 0; padding: 24px 28px; display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 13px; align-items: start; background: #f8f5ed; border-bottom: 1px solid #e8e2d7; }
.application-form > *, .edit-grid > *, .data-page-controls > *, .staff-badge-form > *, .staff-badge-import form > * { min-width: 0; }
.application-form label { margin: 0; }
.application-form input { height: 44px; }
.application-form input:not([type="checkbox"]) { background: #fff; }
.application-form input[type="date"],
.application-form input[type="datetime-local"],
.application-form input[type="time"] { line-height: 42px; }
.application-form input[type="date"]::-webkit-date-and-time-value,
.application-form input[type="datetime-local"]::-webkit-date-and-time-value,
.application-form input[type="time"]::-webkit-date-and-time-value,
.application-form input[type="date"]::-webkit-datetime-edit,
.application-form input[type="datetime-local"]::-webkit-datetime-edit,
.application-form input[type="time"]::-webkit-datetime-edit { height: 42px; min-height: 42px; padding: 0; line-height: 42px; }
.application-form input[type="file"] { padding: 8px; background: white; font-size: 12px; }
.application-form .checkbox-field { align-self: start; }
.application-choice-grid { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 13px; }
.application-choice-card { min-height: 84px; padding: 12px 14px; display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; align-items: center; border: 1px solid #dbe3ef; border-radius: 6px; background: white; }
.application-choice-card > span:first-child { color: var(--muted); font-size: 11px; font-weight: 800; }
.application-choice-card .checkbox-control { justify-self: end; }
.application-choice-card small { grid-column: 1 / -1; color: var(--forest); font-size: 11px; }
.application-choice-field { gap: 9px; }
.application-choice-field .application-choice-card {
  min-height: 44px;
  height: 44px;
  padding: 0 12px;
  grid-template-columns: auto auto;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
  border-color: var(--line);
  border-radius: 4px;
}
.application-choice-field .checkbox-control {
  width: auto;
  height: auto;
  padding: 0;
  justify-self: start;
  border: 0;
  background: transparent;
}
.application-choice-field .application-choice-card small {
  grid-column: auto;
  justify-self: end;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  white-space: nowrap;
}
.reserved-form-slot.is-inactive { visibility: hidden; pointer-events: none; }
.signup-config-card { width: min(520px, calc(100% - 32px)); }
.signup-config-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.signup-config-fields:has(> label:only-child) { grid-template-columns: 1fr; }
.signup-config-fields > label, .signup-config-fields input, .signup-config-card .modal-actions > * { min-width: 0; max-width: 100%; }
.signup-config-fields input { width: 100%; }
.checkbox-control { height: 44px; padding: 0 12px; display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 4px; background: white; }
.checkbox-control input { width: 18px; height: 18px; margin: 0; accent-color: var(--forest); }
.checkbox-control b { font-size: 12px; }
.application-form small { color: var(--muted); font-size: 10px; }
.application-form .form-error { grid-column: 1 / -1; margin: 0; min-height: 0; }
.application-form > button { height: 44px; margin-top: 22px; padding: 0 18px; border: 0; border-radius: 4px; color: white; background: var(--forest); font-weight: 800; white-space: nowrap; }
.application-form > button:hover { background: var(--forest-dark); }
.application-table-wrap { overflow-x: auto; }
.application-table { min-width: 1690px; }
.application-table td { white-space: normal; }
.status-pill { display: inline-block; padding: 5px 9px; border-radius: 16px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.status-pending { color: #8b5a12; background: #fff0cb; }
.status-approved { color: #226646; background: #dceee5; }
.status-rejected { color: #9a382c; background: #f8ddd8; }
.file-actions, .review-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.mini-link, .review-button { padding: 6px 9px; border: 1px solid #cfc9bb; border-radius: 3px; color: var(--forest); background: white; font-size: 11px; text-decoration: none; white-space: nowrap; }
.mini-link:hover, .review-button:hover { border-color: var(--forest); color: white; background: var(--forest); }
.review-button.reject:hover { border-color: var(--danger); background: var(--danger); }

.activity-panel { margin-bottom: 18px; padding: 24px 28px; display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: start; border: 1px solid #dfdacd; background: rgba(255,253,248,.78); }
.activity-panel-heading { position: relative; }
.activity-panel h2 { margin: 0; font: 700 25px "STSong", "SimSun", serif; }
.collapse-button { margin-top: 18px; padding: 6px 13px; border: 1px solid #cfc9bb; border-radius: 18px; color: var(--forest); background: transparent; font-size: 11px; }
.collapse-button:hover { border-color: var(--forest); background: white; }
.admin-panel-toggle { margin-top: 0; white-space: nowrap; }
.student-upload-panel.is-collapsed > :not(.student-upload-heading),
.student-directory-panel.is-collapsed > :not(.student-directory-heading),
.permission-panel.is-collapsed > :not(.permission-heading),
.application-panel.is-collapsed > :not(.application-heading),
.staff-badge-panel.is-collapsed > :not(.staff-badge-heading),
.data-panel.is-collapsed > :not(.panel-heading) { display: none !important; }
.student-upload-panel.is-collapsed { grid-template-columns: 1fr; }
.activity-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.activity-stats.department-mode { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.activity-stats-content { min-width: 0; max-width: 100%; overflow: hidden; }
.activity-stats-more { min-width: 120px; height: 38px; margin: 14px auto 0; padding: 0 24px; display: block; border: 1px solid var(--forest); border-radius: 20px; color: var(--forest); background: white; font-weight: 800; }
.activity-stats-more:hover { color: white; background: var(--forest); }
.activity-stat { padding: 13px 15px; border: 0; border-left: 3px solid var(--orange); background: white; text-align: left; }
.department-stat { min-height: 124px; cursor: pointer; transition: transform .18s, box-shadow .18s; }
.department-stat:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0,67,176,.12); }
.department-stat .department-badge-line { display: grid; gap: 3px; margin-top: 6px; }
.department-stat .department-badge-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.department-stat .department-badge-row strong { margin: 0; }
.department-stat .department-card-hint { color: var(--forest); font-weight: 800; }
.activity-stat b { display: block; overflow: hidden; margin-bottom: 6px; font-size: 13px; white-space: nowrap; text-overflow: ellipsis; }
.activity-stat small { display: block; margin-bottom: 7px; color: var(--orange); font-size: 10px; font-weight: 800; }
.activity-stat span { color: var(--muted); font-size: 12px; }
.activity-stat strong { margin: 0 3px; color: var(--forest); font: 700 18px/1 var(--number-font); font-variant-numeric: tabular-nums; }
.department-stats-card { width: min(920px, calc(100% - 32px)); }
.department-stats-table-wrap { max-height: min(62vh, 620px); overflow: auto; border: 1px solid #dbe8f7; }
.department-stats-table { width: 100%; border-collapse: collapse; }
.department-stats-table th, .department-stats-table td { padding: 12px 14px; border-bottom: 1px solid #e4edf8; text-align: left; font-size: 12px; }
.department-stats-table th { position: sticky; top: 0; z-index: 1; color: var(--muted); background: #f3f8ff; }
.department-stats-table td:nth-child(n+3) { font-weight: 800; white-space: nowrap; }
.export-options-card { width: min(560px, calc(100% - 32px)); }
.export-options-card form { display: grid; gap: 12px; }
.export-choice { margin: 0; padding: 16px; display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; align-items: start; border: 1px solid #dbe8f7; border-radius: 6px; background: #f8fbff; cursor: pointer; }
.export-choice input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--forest); }
.export-choice b, .export-choice small { display: block; }
.export-choice b { margin-bottom: 5px; font-size: 14px; }
.export-choice small { color: var(--muted); font-size: 11px; line-height: 1.6; }

.data-panel { width: 100%; min-width: 0; max-width: 100%; overflow: hidden; contain: inline-size; border: 1px solid #dfdacd; border-radius: 5px 5px 20px 5px; background: var(--paper); box-shadow: 0 20px 60px rgba(23,53,45,.08); }
.panel-heading { padding: 26px 28px; display: flex; justify-content: space-between; align-items: center; gap: 20px; border-bottom: 1px solid #ebe6dc; }
.panel-heading h2 { margin: 0; font: 700 27px "STSong", "SimSun", serif; }
.filters { display: flex; align-items: end; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.filter-control { width: 150px; margin: 0; gap: 5px; }
.filter-control > span { color: var(--muted); font-size: 10px; }
.filter-control select { height: 42px; }
.search-box { width: min(250px, 100%); margin: 0; display: flex; align-items: center; gap: 8px; }
.search-box input { height: 42px; }
.export-button { height: 42px; padding: 0 16px; border: 0; border-radius: 4px; color: white; background: var(--forest); font-weight: 800; white-space: nowrap; }
.export-button:hover { background: var(--forest-dark); }
.export-button:disabled { opacity: .6; cursor: wait; }
.data-message { display: none; margin: 16px 28px 0; padding: 10px 13px; color: var(--danger); background: #fbece9; font-size: 12px; }
.data-message:not(:empty) { display: block; }
.admin-record-add-entry { padding: 18px 28px; border-bottom: 1px solid #e5dfd3; background: #f7f4ed; }
.admin-record-add-entry button { min-height: 44px; padding: 0 20px; border: 0; border-radius: 4px; color: white; background: var(--forest); font-weight: 800; }
.admin-record-add-entry button:hover { background: var(--forest-dark); }
.batch-toolbar { min-height: 58px; padding: 10px 28px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid #e5dfd3; background: #f7f4ed; }
.batch-toolbar > span { margin-right: auto; font-size: 13px; }
.batch-toolbar > span b { color: var(--forest); font: 700 18px/1 var(--number-font); font-variant-numeric: tabular-nums; }
.records-pagination b,
.staff-badge-heading > div > p b,
.application-counts b,
.staff-badge-value,
.badge-pill,
.sync-time b { font-family: var(--number-font); font-variant-numeric: tabular-nums; }
.batch-toolbar label { margin: 0; display: flex; align-items: center; gap: 8px; }
.batch-toolbar label > span { white-space: nowrap; }
.batch-toolbar input { width: 88px; height: 38px; background: white; }
.batch-toolbar button { height: 38px; padding: 0 14px; border: 0; border-radius: 4px; color: white; background: var(--forest); font-weight: 800; }
.batch-toolbar button:hover { background: var(--forest-dark); }
.batch-toolbar button:disabled { opacity: .45; cursor: not-allowed; }
.batch-toolbar .quiet-button { border: 1px solid #cfc9bb; color: var(--ink); background: transparent; }
.table-wrap { width: 100%; min-width: 0; max-width: 100%; inline-size: 100%; max-inline-size: 100%; overflow-x: auto; overflow-y: hidden; contain: layout inline-size paint; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; overscroll-behavior-inline: contain; }
.student-directory-table-wrap,
.staff-badge-table-wrap,
.application-table-wrap,
.department-stats-table-wrap { max-width: 100%; -webkit-overflow-scrolling: touch; overscroll-behavior-inline: contain; }
table { width: 100%; border-collapse: collapse; min-width: 1320px; }
th { padding: 14px 17px; color: #6b7772; background: #f7f4ed; font-size: 12px; text-align: left; white-space: nowrap; }
td { padding: 16px 17px; border-top: 1px solid #eee9df; font-size: 13px; white-space: nowrap; }
tbody tr:hover { background: #fbf8f1; }
.selection-cell { width: 48px; padding-right: 6px; text-align: center; }
.selection-cell input { width: 17px; height: 17px; accent-color: var(--forest); cursor: pointer; }
.badge-pill { display: inline-flex; min-width: 38px; justify-content: center; padding: 4px 8px; border-radius: 20px; color: var(--forest); background: #e2eee9; font-weight: 800; }
.survey-score { color: var(--orange); font-weight: 900; }
.feedback-cell { max-width: 240px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; }
.edit-button { padding: 7px 12px; border: 1px solid #cfc9bb; border-radius: 3px; color: var(--forest); background: white; font-size: 12px; }
.edit-button:hover { color: white; border-color: var(--forest); background: var(--forest); }
.readonly-cell { color: #9aa39f; font-size: 11px; }
.empty-state { padding: 60px 20px; display: grid; gap: 8px; place-items: center; color: var(--muted); }
.empty-state b { color: var(--ink); }

.modal { position: fixed; z-index: 10; inset: 0; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(14,38,31,.6); backdrop-filter: blur(4px); }
.edit-card { position: relative; z-index: 1; width: min(580px, 100%); max-height: calc(100dvh - 40px); padding: 38px; overflow: auto; border-top: 5px solid var(--orange); border-radius: 5px 5px 18px 5px; background: var(--paper); box-shadow: 0 30px 90px rgba(0,0,0,.28); }
.application-edit-card { width: min(820px, 100%); max-height: calc(100vh - 40px); overflow: auto; }
.admin-record-add-card { width: min(700px, 100%); }
.edit-card h2 { margin-bottom: 28px; }
.modal-close { position: absolute; right: 22px; top: 18px; border: 0; color: #6e7975; background: transparent; font-size: 28px; }
.signup-preview-card { width: min(820px, 94vw); max-height: 88vh; }
.signup-preview-table-wrap { max-height: 52vh; overflow: auto; margin: 18px 0; border: 1px solid #ddd6c8; }
.signup-preview-table { width: 100%; border-collapse: collapse; }
.signup-preview-table th, .signup-preview-table td { padding: 10px 12px; border-bottom: 1px solid #e8e2d8; text-align: left; white-space: nowrap; }
.signup-preview-table th { position: sticky; top: 0; background: #f7f3ea; z-index: 1; }
.signup-preview-card .primary-link { display: grid; place-items: center; min-height: 42px; border-radius: 4px; color: #fff; background: var(--green); text-decoration: none; }
.edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
label small { color: var(--muted); font-size: 11px; }
.modal-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; }
.cancel-button { border: 1px solid #cbc5b8; border-radius: 4px; color: var(--ink); background: transparent; }
#application-edit-submit, #application-limit-submit, #admin-record-add-submit { min-height: 48px; border: 0; border-radius: 4px; color: white; background: var(--forest); font-weight: 800; }
#application-edit-submit:disabled, #application-limit-submit:disabled, #admin-record-add-submit:disabled { opacity: .55; cursor: wait; }
.review-summary { margin: -10px 0 22px; padding: 14px 16px; border-left: 4px solid var(--orange); background: #f7f3e9; color: var(--muted); font-size: 13px; line-height: 1.8; white-space: pre-line; }
.decision-field { margin: 0 0 20px; padding: 0; display: flex; gap: 12px; border: 0; }
.decision-field legend { width: 100%; margin-bottom: 9px; font-size: 13px; font-weight: 800; }
.decision-field label { margin: 0; display: flex; align-items: center; cursor: pointer; }
.decision-field input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.decision-field span { padding: 9px 24px; border: 1px solid #cbc5b8; border-radius: 4px; background: white; }
.decision-field input:checked + span { border-color: var(--forest); color: white; background: var(--forest); }
.qr-card { text-align: center; }
.qr-card h2 { margin-bottom: 8px; }
.qr-activity { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.qr-image { width: min(300px, 80vw); height: min(300px, 80vw); margin: 0 auto 14px; display: block; padding: 10px; border: 1px solid var(--line); background: white; }
.qr-link { margin: 0 0 22px; display: block; overflow-wrap: anywhere; color: var(--forest); font-size: 11px; }
#copy-signup-link { border: 0; border-radius: 4px; color: white; background: var(--forest); font-weight: 800; }
.qr-modal-actions { grid-template-columns: .8fr 1.3fr 1.3fr; }
#download-signup-qr { border: 0; border-radius: 4px; color: white; background: #1768d4; font-weight: 800; }

.toast { position: fixed; z-index: 20; right: 24px; bottom: 24px; max-width: 380px; padding: 15px 18px; border-left: 5px solid var(--forest); border-radius: 4px; color: var(--ink); background: white; box-shadow: 0 16px 48px rgba(0,0,0,.18); opacity: 0; transform: translateY(30px); pointer-events: none; transition: .25s; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.error { border-left-color: var(--danger); }

/* Blue visual system based on the supplied five-color palette. */
.summary article,
.level-one-page-heading,
.activity-panel { border-color: #d3e3f5; background: rgba(251,253,255,.88); }
.admin-menu-card,
.student-upload-panel,
.student-directory-panel,
.permission-panel,
.staff-badge-panel,
.application-panel,
.data-panel { border-color: #d3e3f5; box-shadow: 0 18px 54px rgba(0,67,176,.08); }
.admin-menu-card:hover { border-color: #74a8ff; box-shadow: 0 22px 58px rgba(0,67,176,.14); }
.staff-badge-heading,
.student-directory-heading,
.permission-heading,
.application-heading,
.panel-heading { border-color: #dbe8f7; }
.staff-badge-form,
.application-form,
.batch-toolbar,
th,
.records-pagination { border-color: #dbe8f7; background: #f3f8ff; }
.staff-badge-import { border-color: #dbe8f7; background: #edf5ff; }
.permission-item,
.activity-stat { border-color: #dbe8f7; background: #f9fcff; }
td { border-color: #e4edf8; }
tbody tr:hover { background: #f2f8ff; }
.badge-pill { color: #0043b0; background: #dcecff; }
.page-back-button:hover,
.records-pagination button:hover:not(:disabled) { background: #edf5ff; }
.topbar { padding-bottom: 18px; border-bottom: 1px solid rgba(83,141,239,.22); }

@media (max-width: 900px) {
  .activity-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .activity-stats.department-mode { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-view { grid-template-columns: minmax(0, 1fr); background: linear-gradient(180deg, #2c73d2 0 58%, #0043b0 100%); }
  .login-brand { min-width: 0; min-height: 390px; padding: 36px; background: #edf6ff; }
  .login-brand > p:last-child { white-space: normal; }
  .login-card { min-width: 0; margin: -42px auto 50px; }
  .summary { grid-template-columns: 1fr 1fr; }
  .badge-distribution-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
  .badge-distribution-insight { max-width: none; }
  .activity-panel { grid-template-columns: 1fr; }
  .application-form { grid-template-columns: 1fr 1fr; }
  .application-choice-grid { grid-template-columns: 1fr 1fr; }
  .student-upload-panel { grid-template-columns: 1fr; }
  .student-directory-heading { align-items: stretch; flex-direction: column; }
  .student-directory-search { width: 100%; }
  .staff-badge-heading { align-items: stretch; flex-direction: column; }
  .staff-badge-form { grid-template-columns: 1fr 1fr; }
  .staff-badge-import { grid-template-columns: 1fr; }
  .staff-badge-import form { grid-template-columns: 1fr 1fr; }
  .application-form > button { margin-top: 0; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .admin-menu-card { grid-template-columns: 48px minmax(0, 1fr) 28px; }
  .admin-menu-status { grid-column: 2; justify-self: start; }
  .data-page-heading { align-items: stretch; flex-wrap: wrap; }
  .data-page-actions { width: 100%; margin-left: 0; justify-items: stretch; }
  .data-page-entry-buttons { width: 100%; }
  .archive-page-entry { justify-self: end; }
  .data-page-controls { width: 100%; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
  .data-page-controls.department-filter-hidden { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .analytics-filter-controls { grid-template-columns: 1fr 1fr; }
  .data-global-search { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .activity-stats { grid-template-columns: 1fr; }
  .qr-modal-actions { grid-template-columns: 1fr; }
  .badge-overview-heading { padding: 16px; align-items: center; flex-direction: row; gap: 10px; }
  .badge-overview-heading h2 { font-size: 22px; }
  .badge-overview-heading .export-button { height: 38px; padding: 0 10px; font-size: 12px; flex: 0 0 auto; }
  .activity-stats.department-mode { grid-template-columns: 1fr; }
  .login-brand { padding: 28px 24px 36px; }
  .login-brand h1 { font-size: clamp(36px, 11vw, 52px); }
  .login-card { width: calc(100% - 24px); margin: -30px auto 36px; }
  .dashboard { width: min(100% - 24px, 1440px); padding-top: 24px; }
  .topbar-actions { width: 100%; flex-wrap: wrap; }
  .topbar-brand { align-items: flex-start; }
  .topbar-mascot { width: 76px; height: 62px; }
  .live-state { width: 100%; margin-bottom: 5px; }
  .sync-time { width: 100%; }
  .summary { grid-template-columns: 1fr 1fr; }
  .badge-distribution-panel { padding: 20px 16px 22px; }
  .badge-distribution-metrics { grid-template-columns: 1fr 1fr; }
  .badge-distribution-row { grid-template-columns: 56px minmax(70px, 1fr) 82px; gap: 8px; }
  .badge-distribution-count small { display: block; margin: 3px 0 0; }
  .summary article { min-height: 108px; padding: 16px; }
  .summary strong { font-size: 24px; }
  .badge-summary-card > span { font-size: 0; }
  .badge-summary-card > span::before { content: "德育章"; font-size: 12px; }
  .badge-summary-card .badge-breakdown { display: grid; gap: 4px; white-space: normal; }
  .badge-summary-card .badge-breakdown b { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: clamp(17px, 4.8vw, 20px); }
  .badge-summary-card .badge-breakdown b::before { content: attr(data-label); color: var(--muted); font: 700 11px/1.2 "Microsoft YaHei", "PingFang SC", system-ui, sans-serif; }
  .badge-summary-card .badge-breakdown i { display: none; }
  .admin-menu-card { padding: 20px; grid-template-columns: 38px minmax(0, 1fr) 22px; gap: 12px; }
  .admin-menu-copy b { font-size: 22px; }
  .level-one-page-heading { padding: 20px; align-items: flex-start; flex-direction: column; }
  .analytics-filter-panel { padding: 18px 16px; }
  .analytics-filter-heading { align-items: stretch; flex-direction: column; }
  .analytics-filter-heading .quiet-button { width: 100%; }
  .analytics-filter-controls { grid-template-columns: 1fr; }
  .data-page-controls { grid-template-columns: 1fr; }
  .data-page-controls.department-filter-hidden { grid-template-columns: 1fr; }
  .data-page-entry-buttons { display: grid; grid-template-columns: 1fr; }
  .archive-page-entry { width: 100%; }
  .data-global-search { grid-column: auto; }
  .roster-filter-control { grid-column: auto; grid-template-columns: 1fr; }
  .roster-filter-label, .roster-filter-control small { grid-column: auto; }
  .panel-heading { align-items: stretch; flex-direction: column; }
  .filters, .search-box, .filter-control, .export-button { width: 100%; }
  .batch-toolbar { align-items: stretch; flex-direction: column; }
  .batch-toolbar > span { margin-right: 0; }
  .batch-toolbar label { justify-content: space-between; }
  .batch-toolbar button { width: 100%; }
  .records-pagination { align-items: stretch; flex-direction: column; text-align: center; }
  .modal { padding: 12px; }
  .login-card, .edit-card { max-height: calc(100dvh - 24px); padding: 30px 24px; }
  .application-heading { align-items: flex-start; flex-direction: column; }
  .permission-heading { align-items: flex-start; flex-direction: column; }
  .application-form { grid-template-columns: 1fr; }
  .application-choice-grid { grid-template-columns: 1fr; }
  .application-choice-card { grid-template-columns: 1fr; }
  .application-choice-card .checkbox-control { justify-self: start; }
  .application-choice-card small { grid-column: 1; }
  .signup-config-fields { grid-template-columns: 1fr; }
  .student-upload-panel { padding: 20px; }
  .student-upload-panel form { grid-template-columns: minmax(0, 1fr); }
  .support-qq-form { grid-template-columns: 1fr; }
  .account-form, .admin-account-item { grid-template-columns: 1fr; }
  .admin-account-list { padding: 14px; }
  .admin-account-group-heading { align-items: flex-start; flex-direction: column; }
  .admin-account-departments { grid-template-columns: 1fr; }
  .staff-badge-form { padding: 20px; grid-template-columns: minmax(0, 1fr); }
  .staff-badge-import { padding: 20px; }
  .staff-badge-import form { grid-template-columns: minmax(0, 1fr); }
  .edit-grid { grid-template-columns: 1fr; gap: 0; }
  input[type="date"], input[type="datetime-local"], input[type="time"] { width: 100%; min-width: 0; max-width: 100%; padding-right: 8px; font-size: 16px; }
  .modal-actions button, .records-pagination button, .batch-toolbar button { min-height: 42px; font-size: 12px; }
}

@media (max-width: 360px) {
  .summary { grid-template-columns: 1fr; }
  .badge-overview-heading { align-items: stretch; flex-wrap: wrap; }
  .badge-overview-heading .export-button { width: 100%; }
  .admin-menu-card { grid-template-columns: 30px minmax(0, 1fr) 20px; padding: 16px; }
  .admin-menu-copy b { font-size: 20px; }
  .modal-actions { grid-template-columns: 1fr; }
}
.support-watermark {
  position: fixed;
  right: 10px;
  bottom: 8px;
  z-index: 50;
  color: rgba(90, 98, 94, 0.42);
  font-size: 11px;
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

.archive-panel {
  margin: 20px 0;
  padding: 24px;
  border: 1px solid rgba(83, 141, 239, .24);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(25, 72, 135, .08);
}
.archive-panel-heading h2 { margin: 2px 0 6px; }
.archive-panel-heading p:last-child { margin: 0; color: #64748b; }
.archive-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(2, minmax(170px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  margin-top: 20px;
}
.archive-form label { display: grid; gap: 7px; color: #475569; font-size: 13px; }
.archive-form input { min-height: 44px; }
.archive-form button,
.archive-restore-button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 0 18px;
  color: #fff;
  background: #1768d4;
  cursor: pointer;
}
.archive-form button:disabled,
.archive-restore-button:disabled { opacity: .55; cursor: wait; }
.archive-list { display: grid; gap: 10px; margin-top: 10px; }
.archive-item {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(230px, 1.4fr) auto;
  gap: 16px;
  align-items: center;
  padding: 15px 16px;
  border: 1px solid #dbe7f7;
  border-radius: 14px;
  background: #f8fbff;
}
.archive-item b, .archive-item span, .archive-item small { display: block; }
.archive-item span { color: #475569; }
.archive-item small { margin-top: 4px; color: #8491a5; }
.archive-restore-button { min-height: 38px; background: #e7f0fd; color: #1255ae; }
.admin-record-add-page > form { width: 100%; max-width: none; }
.admin-record-common-fields { margin-bottom: 8px; }
.admin-record-add-page .staff-badge-import { margin-top: 24px; border: 1px solid #dbe8f7; border-radius: 12px; }
.admin-record-import-file { align-self: end; }
.admin-record-add-page .modal-actions { margin-top: 22px; }
.archive-date-button { display: block; width: 100%; padding: 7px 9px; border: 1px dashed #a9c4e8; border-radius: 9px; color: #1255ae; background: #fff; text-align: left; cursor: pointer; }
.archive-date-button:hover { background: #edf5ff; }
.archive-date-edit-form { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 8px; align-items: end; }
.archive-date-edit-form label { display: grid; gap: 4px; color: #64748b; font-size: 12px; }
.archive-date-edit-form input { min-width: 135px; height: 38px; }
.archive-date-edit-form button { min-height: 38px; border: 0; border-radius: 9px; padding: 0 12px; cursor: pointer; }
.archive-date-save { color: #fff; background: #1768d4; }
.archive-date-cancel { color: #475569; background: #e8eef6; }

@media (max-width: 900px) {
  .archive-form { grid-template-columns: 1fr 1fr; }
  .archive-form label:first-child { grid-column: 1 / -1; }
  .archive-date-edit-form { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .archive-panel { padding: 20px; }
  .archive-form, .archive-item { grid-template-columns: 1fr; }
  .archive-date-edit-form { grid-template-columns: 1fr; }
  .archive-form label:first-child { grid-column: auto; }
  .archive-restore-button { width: 100%; }
}
