html { width: 100%; }
body { min-width: 0; }
button, input, select, textarea { min-width: 0; max-width: 100%; }
button { touch-action: manipulation; }
button:disabled { background: #e9edf2; color: #98a0aa; cursor: default; }
.brand, .user-info, .send-layout > div, .settings-panel { min-width: 0; }
.brand h1, .user-info span { overflow-wrap: anywhere; }
.sender-hint { margin: -3px 0 10px; color: #7b8492; font-size: 12px; line-height: 1.6; }
.qr-login-panel img.is-expired { opacity: .2; filter: blur(2px); }
.settings-grid { display: flex; flex-direction: column; gap: 0; }
.settings-grid > .settings-panel { border: 0; border-radius: 0; background: transparent; padding: 16px 0; border-bottom: 1px solid var(--line); }
.settings-grid > .settings-panel:first-child { padding-top: 0; }
.settings-grid > .settings-panel:last-child { border-bottom: 0; }
.settings-grid .panel-title { font-size: 15px; font-weight: 700; }
.settings-inline { align-items: center; max-width: 100%; }
.settings-inline .settings-input { margin: 0; flex: 0 1 310px; }
.department-settings .settings-input { flex-basis: 140px; max-width: 180px; }
.settings-inline button { min-height: 36px; }
.department-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.department-chip { position: relative; padding: 7px 12px; border: 1px solid #d6e2ef; border-radius: 6px; background: #f5f8fc; color: #344254; font-size: 13px; line-height: 20px; max-width: 100%; overflow-wrap: anywhere; }
.department-remove { position: absolute; right: -5px; top: -7px; width: 24px; height: 24px; padding: 0; display: grid; place-items: center; border: 1px solid #d7e0e9; border-radius: 50%; background: #fff; color: #788392; font-size: 18px; font-weight: 400; }
.department-remove:hover, .admin-delete:hover { color: #c03646; background: #fff1f2; }
.admin-list { display: flex; flex-direction: column; gap: 0; }
.admin-row { display: grid; grid-template-columns: minmax(130px,1.1fr) minmax(80px,.65fr) minmax(76px,.4fr) minmax(80px,.6fr) minmax(140px,1.3fr) minmax(120px,1fr) 148px; gap: 10px; padding: 14px 0; border-bottom: 1px solid #edf0f4; align-items: end; }
.admin-value { min-height: 36px; display: flex; align-items: center; color: #344254; font-size: 13px; line-height: 20px; overflow-wrap: anywhere; }
.settings-edit { height: 36px; padding: 0 10px; background: #edf2f8; color: #44556c; white-space: nowrap; }
.settings-edit:hover { background: #e2eaf5; }
.admin-field { min-width: 0; display: flex; flex-direction: column; gap: 6px; color: #687385; font-size: 12px; }
.admin-field > span { line-height: 18px; }
.admin-field > input { width: 100%; height: 36px; padding: 0 9px; font-size: 13px; }
.portal-multi-select { width: 100%; height: 36px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: #344254; font-size: 13px; font-weight: 400; }
.portal-multi-select:hover, .portal-multi-select[aria-expanded=true] { background: #f8fbff; border-color: #89afe7; }
.multi-summary { display: block; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.multi-chevron { flex: 0 0 6px; width: 6px; height: 6px; border-right: 1px solid #7b8798; border-bottom: 1px solid #7b8798; transform: translateY(-2px) rotate(45deg); }
.admin-row-actions { display: flex; align-items: center; gap: 4px; height: 36px; }
.admin-save { height: 36px; padding: 0 10px; font-size: 12px; white-space: nowrap; flex-shrink: 0; }
.admin-delete { width: 28px; height: 32px; padding: 0; font-size: 22px; font-weight: 400; background: transparent; color: #8b96a4; }
.portal-multi-menu { position: fixed; z-index: 1200; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 5px; background: #fff; border: 1px solid #ced9e6; border-radius: 6px; box-shadow: 0 6px 20px #17203322; }
.portal-multi-menu label { display: flex; align-items: flex-start; gap: 9px; min-height: 38px; padding: 9px; border-radius: 4px; font-size: 13px; color: #344254; cursor: pointer; line-height: 20px; }
.portal-multi-menu label:hover { background: #f1f6fd; }
.portal-multi-menu input { flex: 0 0 16px; width: 16px; height: 16px; margin-top: 2px; accent-color: #2563eb; }
.portal-multi-menu span { overflow-wrap: anywhere; }
.settings-empty, .multi-empty { font-size: 13px; color: #85909f; padding: 8px 0; line-height: 1.6; }
.multi-empty { padding: 12px; }
.settings-status { min-height: 24px; font-size: 13px; line-height: 24px; color: #23804d; overflow-wrap: anywhere; }
.settings-status.is-error { color: #bf3544; }
@media (max-width: 1100px) {
  .admin-row { grid-template-columns: minmax(130px,1fr) minmax(100px,1fr) minmax(120px,1fr) minmax(120px,1fr); }
  .admin-row-actions { justify-content: flex-end; grid-column: -2 / -1; }
}
@media (max-width: 768px) {
  .header { align-items: center; }
  .brand h1 { font-size: 15px; }
  .brand { flex-shrink: 0; }
  .header .brand h1 { max-width: 140px; }
  .brand-badge { flex: 0 0 30px; height: 30px; }
  .header .user-info { font-size: 12px; }
  .header .user-info span { max-width: 140px; }
  .tabs { gap: 0; }
  .tab { flex: 1 0 auto; justify-content: center; padding: 0 10px; font-size: 13px; }
  .toolbar { display: flex; gap: 8px; }
  .toolbar button { width: auto; min-height: 38px; height: auto; line-height: 1.4; padding: 8px 10px; }
  .toolbar select { width: auto; max-width: 100%; flex: 1 1 140px; }
  .group-check-list { width: 100%; }
  .group-check-list label { max-width: 100%; height: auto; min-height: 36px; overflow-wrap: anywhere; }
  .toolbar .group-check-list input { width: 16px; min-width: 16px; max-width: 16px; flex: 0 0 16px; height: 16px; padding: 0; }
  .send-layout, .manage-layout { grid-template-columns: minmax(0,1fr); }
  .list-scroll { min-height: 0; max-height: 360px; height: auto; padding: 6px; touch-action: pan-y; }
  .class-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; }
  .class-card { padding: 10px 28px 10px 10px; min-width: 0; min-height: 94px; }
  .class-card .code { font-size: 13px; }
  .class-card .check { width: 18px; height: 18px; top: 10px; right: 7px; }
  .class-card .name, .class-card .meta { overflow-wrap: anywhere; font-size: 12px; }
  .class-card .client-version { margin-left: 0; }
  .panel-title-row { flex-wrap: wrap; gap: 8px; }
  .list-stats { gap: 6px; font-size: 12px; }
  .send-panel { margin-top: 0; }
  .send-panel input, .send-panel select, .send-panel textarea, .settings-input, .admin-field > input { font-size: 16px; }
  .school-image-row { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); }
  .school-image-row .school-image-picker, .school-image-row .school-schedule-control { width: 100%; padding: 0 6px; gap: 4px; font-size: 12px; }
  .school-schedule-control { grid-column: auto; }
  .table-scroll { width: 100%; max-width: 100%; overflow: auto; -webkit-overflow-scrolling: touch; }
  .record-table > table { min-width: 0; table-layout: auto; border: 0; }
  .record-table > table > thead { display: none; }
  #recordsList > tr.record-row { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 5px 12px; padding: 12px 10px; border-bottom: 1px solid var(--line); }
  #recordsList > tr.record-row > td { border: 0; padding: 0; font-size: 12px; overflow-wrap: anywhere; }
  #recordsList > tr.record-row > td:nth-child(1) { font-weight: 700; }
  #recordsList > tr.record-row > td:nth-child(2) { grid-column: 1/-1; grid-row: 2; max-width: none !important; }
  #recordsList > tr.record-row > td:nth-child(3)::before { content: '总数/成功/签收：'; color: #7b8798; }
  #recordsList > tr.record-row > td:nth-child(4) { grid-row: 1; grid-column: 2; justify-self: end; }
  #recordsList > tr.record-row > td:nth-child(5) { grid-column: 1/-1; }
  #recordsList > tr.record-row > td:nth-child(6) { grid-column: 1/-1; }
  #recordsList > tr.record-detail-row.open { display: block; }
  #recordsList > tr.record-detail-row > td { display: block; }
  .inline-record-detail { margin: 6px; }
  .record-detail-head { flex-wrap: wrap; }
  .record-detail-counts { display: block; margin: 4px 0 0; }
  .manage-toolbar .manage-save { margin-left: 0; }
  .settings-inline .settings-input { flex: 1 1 auto; width: 0; }
  .owner-settings .settings-input { max-width: 360px; }
  .department-settings .settings-input { max-width: 220px; }
  .admin-row { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; padding: 14px 0; }
  .admin-row-actions { grid-column: 1/-1; }
  .portal-multi-select { min-height: 40px; font-size: 14px; }
  .admin-row-actions button { height: 38px; }
  .admin-row-actions .admin-save { min-width: 70px; }
  .portal-multi-menu label { min-height: 44px; font-size: 14px; }
  .school-login-intro { padding: 22px; }
  .school-login-intro h1 { font-size: 23px; }
  .school-login-intro p, .school-login-projects, .school-login-kicker { display: none; }
  .school-login-intro .login-mark { margin-bottom: 10px; }
  #loginPage { padding: 14px; }
  .login-container { padding: 22px 18px; }
  .login-container input { font-size: 16px; }
  .qr-login-panel img { max-width: 100%; height: auto; aspect-ratio: 1; }
}
@media (max-width: 360px) {
  .header { flex-wrap: wrap; }
  .header .user-info { width: 100%; justify-content: flex-start; }
  .content { padding: 10px; }
  .tab { padding: 0 8px; }
  .class-grid { grid-template-columns: minmax(0,1fr); }
}
