:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --ink: #152033;
  --muted: #687386;
  --line: #dfe5ec;
  --blue: #1f4e79;
  --green: #16775b;
  --green-soft: #e9f7f2;
  --red: #b42318;
  --red-soft: #fff1f0;
  --amber: #a15c00;
  --amber-soft: #fff7e6;
  --shadow: 0 12px 32px rgba(21, 32, 51, 0.08);
}

/* Homeroom-only class performance display keeps the classroom mounted underneath. */
body.class-performance-open {
  overflow: hidden;
}

.class-performance-entry {
  border-color: #2d67a1;
  color: #1f4e79;
  white-space: nowrap;
}

.class-performance-view {
  background:
    linear-gradient(135deg, rgba(31, 78, 121, .06), transparent 38%),
    #eef3f8;
  color: #10233d;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  inset: 0;
  overflow: hidden;
  padding: 12px;
  position: fixed;
  z-index: 80;
}

.class-performance-view[hidden] {
  display: none;
}

.class-performance-header {
  align-items: center;
  background: linear-gradient(118deg, #173a68, #245c98 68%, #2f7a70);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(23, 58, 104, .2);
  color: #fff;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(230px, 1fr) auto auto;
  min-height: 78px;
  padding: 12px 16px;
}

.class-performance-title-block {
  min-width: 0;
}

.class-performance-title-block > span {
  color: #bfe7db;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .18em;
}

.class-performance-title-block h1 {
  font-size: clamp(21px, 2vw, 30px);
  line-height: 1.05;
  margin: 2px 0 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.class-performance-range {
  align-items: center;
  color: #dbeafe;
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 7px;
  margin: 5px 0 0;
}

.class-performance-week-badge {
  background: #fff;
  border-radius: 7px;
  box-shadow: 0 3px 10px rgba(9, 35, 67, .18);
  color: #1f4e79;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  padding: 5px 8px;
}

.class-performance-range-dates {
  color: #eaf4ff;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.class-performance-range small {
  color: #c6efe5;
  font-size: 11px;
  font-weight: 800;
}

.class-performance-timebar {
  align-items: center;
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(4, minmax(94px, 1fr));
}

.class-performance-timebar button,
.class-performance-close {
  border-color: rgba(255, 255, 255, .26);
  min-height: 34px;
  padding: 6px 11px;
}

.class-performance-timebar button {
  background: rgba(255, 255, 255, .1);
  color: #fff;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
  width: 100%;
}

.class-performance-timebar button:hover:not(:disabled),
.class-performance-timebar button:focus-visible {
  background: #dff4ef;
  border-color: #dff4ef;
  color: #164d54;
  outline: 2px solid rgba(255, 255, 255, .72);
  outline-offset: 2px;
  transform: translateY(-1px);
}

.class-performance-timebar button.active {
  background: #fff;
  border-color: #fff;
  box-shadow: 0 4px 12px rgba(8, 31, 61, .2);
  color: #1f4e79;
}

.class-performance-timebar button.active:hover,
.class-performance-timebar button.active:focus-visible {
  background: #eefaf6;
  border-color: #eefaf6;
  color: #174f59;
}

.class-performance-timebar button:disabled {
  background: rgba(255, 255, 255, .05);
  border-color: rgba(255, 255, 255, .12);
  color: rgba(255, 255, 255, .42);
  cursor: not-allowed;
}

.class-performance-close {
  background: #fff;
  color: #173a68;
}

.class-performance-tabs {
  align-items: center;
  background: #fff;
  border: 1px solid #dce5ef;
  border-radius: 11px;
  display: grid;
  gap: 5px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 8px;
  padding: 5px;
}

.class-performance-tabs button {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #667085;
  font-size: 14px;
  font-weight: 850;
  min-height: 36px;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.class-performance-tabs button:hover,
.class-performance-tabs button:focus-visible {
  background: #e9f2fb;
  border-color: #b9cde2;
  color: #1f4e79;
  outline: 2px solid rgba(47, 107, 255, .2);
  outline-offset: 1px;
  transform: translateY(-1px);
}

.class-performance-tabs button.active {
  background: #1f4e79;
  color: #fff;
  box-shadow: 0 4px 12px rgba(31, 78, 121, .18);
}

.class-performance-tabs button.active:hover,
.class-performance-tabs button.active:focus-visible {
  background: #173f6a;
  border-color: #173f6a;
  color: #fff;
}

@media (prefers-reduced-motion: reduce) {
  .class-performance-timebar button,
  .class-performance-tabs button {
    transition: none;
  }

  .class-performance-timebar button:hover:not(:disabled),
  .class-performance-timebar button:focus-visible,
  .class-performance-tabs button:hover,
  .class-performance-tabs button:focus-visible {
    transform: none;
  }
}

.class-performance-status {
  align-items: center;
  background: #fff;
  border: 1px solid #dce5ef;
  border-radius: 10px;
  color: #667085;
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 8px;
  min-height: 48px;
  padding: 8px 14px;
}

.class-performance-status[hidden] {
  display: none;
}

.class-performance-status button {
  background: #1f4e79;
  border: 0;
  border-radius: 7px;
  color: #fff;
  min-height: 30px;
  padding: 4px 12px;
}

.class-performance-content {
  min-height: 0;
  overflow: auto;
  padding-top: 8px;
}

.positive { color: #16805d !important; }
.negative { color: #b42318 !important; }
.neutral { color: #64748b !important; }

.performance-matrix-wrap {
  background: #fff;
  border: 1px solid #d7e1ec;
  border-radius: 11px;
  max-height: calc(100vh - 158px);
  overflow: auto;
}

.performance-matrix {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 100%;
  table-layout: fixed;
}

.performance-matrix th,
.performance-matrix td {
  background: #fff;
  border-bottom: 1px solid #edf1f5;
  border-right: 1px solid #edf1f5;
  height: 46px;
  min-width: 112px;
  padding: 4px 8px;
  text-align: center;
}

.performance-matrix thead th {
  background: #edf4fb;
  color: #344054;
  font-size: 12px;
  font-weight: 850;
  position: sticky;
  top: 0;
  z-index: 3;
}

.matrix-sort {
  align-items: center;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: inherit;
  gap: 5px;
  justify-content: center;
  min-height: 30px;
  padding: 2px 5px;
  width: 100%;
}

.matrix-sort span { color: #718399; font-size: 11px; }
.matrix-sort:hover,
.matrix-sort:focus-visible { background: #dfeaf5; border-radius: 6px; outline: 2px solid rgba(47, 107, 255, .28); }

.performance-matrix th:first-child {
  left: 0;
  min-width: 150px;
  position: sticky;
  text-align: left;
  width: 150px;
  z-index: 2;
}

.performance-matrix thead th:first-child {
  z-index: 4;
}

.performance-matrix tbody th {
  align-items: center;
  display: flex;
  gap: 8px;
}

.performance-matrix tbody th span {
  color: #98a2b3;
  font-size: 10px;
  min-width: 24px;
}

.performance-matrix tbody th strong {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matrix-score {
  background: #f4f7fa;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 900;
  min-height: 31px;
  min-width: 64px;
}

.matrix-score.positive { background: #e9f7f2; border-color: #b9e2d3; }
.matrix-score.negative { background: #fff1f0; border-color: #f2c5c0; }
.matrix-score:hover,
.matrix-score:focus-visible { box-shadow: 0 0 0 3px rgba(47, 107, 255, .18); transform: translateY(-1px); }
.matrix-total { font-size: 15px; font-weight: 900; }

.performance-person-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.performance-person-card {
  align-items: center;
  background: #fff;
  border: 1px solid #dce5ef;
  border-radius: 11px;
  color: #10233d;
  display: grid;
  gap: 5px;
  grid-template-columns: auto minmax(0, 1fr);
  min-height: 82px;
  padding: 9px 11px;
  text-align: left;
}

.performance-person-card:hover,
.performance-person-card:focus-visible {
  border-color: #2f6bff;
  box-shadow: 0 8px 18px rgba(31, 78, 121, .12);
}

.person-number {
  color: #98a2b3;
  font-size: 10px;
}

.performance-person-card > strong {
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-scores {
  display: grid;
  gap: 4px;
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  text-align: center;
}

.person-scores i,
.person-scores b {
  background: #f4f7fa;
  border-radius: 6px;
  font-size: 12px;
  font-style: normal;
  padding: 4px;
}

.performance-person-meter {
  background: #dbe6ef;
  border-radius: 999px;
  display: flex;
  grid-column: 1 / -1;
  height: 5px;
  margin-top: 3px;
  overflow: hidden;
}

.performance-person-meter .add { background: #24a47f; }
.performance-person-meter .deduct { background: #e35d53; }

.performance-project-switches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.performance-project-switches button {
  background: #fff;
  border: 1px solid #d7e1ec;
  border-radius: 999px;
  color: #475467;
  font-weight: 800;
  min-height: 36px;
  padding: 6px 16px;
}

.performance-project-switches button.active {
  background: #1f4e79;
  border-color: #1f4e79;
  color: #fff;
}

.performance-attendance-board,
.performance-project-ranking {
  max-height: calc(100vh - 207px);
  overflow: auto;
}

.performance-attendance-board {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 2fr) minmax(210px, 1fr) minmax(210px, 1fr);
  overflow: hidden;
}

.attendance-zone {
  background: #fff;
  border: 1px solid #d7e1ec;
  border-radius: 12px;
  min-width: 0;
  overflow: hidden;
}

.attendance-zone.normal { border-color: #badfce; }
.attendance-zone.leave { border-color: #ead7a7; }
.attendance-zone.attention { border-color: #edc3be; }

.attendance-zone h3 {
  align-items: center;
  display: flex;
  font-size: 15px;
  gap: 8px;
  margin: 0;
  min-height: 44px;
  padding: 8px 13px;
}

.attendance-zone h3 i {
  background: currentColor;
  border-radius: 50%;
  height: 9px;
  width: 9px;
}

.attendance-zone h3 small {
  color: #667085;
  font-size: 12px;
  font-weight: 750;
  margin-left: auto;
}

.attendance-zone.normal h3 { background: #edf8f3; color: #157055; }
.attendance-zone.leave h3 { background: #fff8e7; color: #98630b; }
.attendance-zone.attention h3 { background: #fff1f0; color: #aa3027; }

.attendance-zone-list {
  display: grid;
  gap: 6px;
  padding: 9px;
}

.attendance-zone.normal .attendance-zone-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.attendance-student-card {
  align-items: center;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #94a3b8;
  border-radius: 8px;
  color: #10233d;
  display: grid;
  gap: 7px;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  min-height: 36px;
  padding: 5px 9px;
  text-align: left;
  width: 100%;
}

.attendance-student-card.normal { border-left-color: #29a278; }
.attendance-student-card.leave { background: #fffdf6; border-left-color: #d49a2c; }
.attendance-student-card.attention { background: #fff9f8; border-left-color: #d8584d; }
.attendance-student-card:hover,
.attendance-student-card:focus-visible { border-color: #2f6bff; box-shadow: 0 5px 14px rgba(31, 78, 121, .13); outline: 2px solid rgba(47, 107, 255, .18); transform: translateY(-1px); }
.attendance-number { color: #718399; font-size: 11px; }
.attendance-student-card strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attendance-card-detail { color: #667085; font-size: 11px; white-space: nowrap; }

.performance-project-ranking {
  background: #fff;
  border: 1px solid #d7e1ec;
  border-radius: 11px;
  display: block;
}

.performance-project-ranking-head,
.performance-project-ranking button {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: 48px minmax(170px, .85fr) minmax(280px, 1.7fr) 58px 58px 64px;
  min-height: 44px;
  padding: 7px 14px;
  text-align: left;
}

.performance-project-ranking-head {
  background: #edf4fb;
  color: #52647a;
  font-size: 11px;
  font-weight: 850;
  position: sticky;
  top: 0;
  z-index: 2;
}

.performance-project-ranking button {
  background: #fff;
  border: 0;
  border-bottom: 1px solid #edf1f5;
  color: #10233d;
  width: 100%;
}

.performance-project-ranking button:hover,
.performance-project-ranking button:focus-visible { background: #f5f9fd; box-shadow: inset 3px 0 #2f6bff; outline: none; }
.performance-project-ranking em { color: #98a2b3; font-size: 11px; font-style: normal; }
.performance-project-ranking strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.performance-project-ranking > button > span,
.performance-project-ranking > button > b { text-align: right; }

.performance-project-scorebar {
  display: grid;
  gap: 2px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  height: 10px;
}

.performance-project-bar-negative,
.performance-project-bar-positive {
  align-items: center;
  background: #edf2f7;
  display: flex;
  height: 100%;
  overflow: hidden;
}

.performance-project-bar-negative { border-radius: 999px 2px 2px 999px; justify-content: flex-end; }
.performance-project-bar-positive { border-radius: 2px 999px 999px 2px; justify-content: flex-start; }
.performance-project-bar-negative b { background: #df6158; border-radius: 999px 2px 2px 999px; display: block; height: 100%; }
.performance-project-bar-positive b { background: #25a581; border-radius: 2px 999px 999px 2px; display: block; height: 100%; }

.class-performance-detail {
  background: #fff;
  border-left: 1px solid #d7e1ec;
  box-shadow: -16px 0 40px rgba(16, 35, 61, .16);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  inset: 0 0 0 auto;
  max-width: 430px;
  min-width: 340px;
  position: fixed;
  width: 34vw;
  z-index: 84;
}

.class-performance-detail[hidden] { display: none; }
.class-performance-detail > header { align-items: center; background: #173a68; color: #fff; display: flex; justify-content: space-between; padding: 14px 16px; }
.class-performance-detail h2 { font-size: 18px; margin: 0; }
.class-performance-detail-list { min-height: 0; overflow: auto; padding: 10px; }
.performance-detail-row { align-items: center; border-bottom: 1px solid #edf1f5; display: grid; gap: 9px; grid-template-columns: 84px minmax(0, 1fr) 42px; min-height: 48px; padding: 5px 3px; }
.performance-detail-row time { color: #98a2b3; font-size: 11px; }
.performance-detail-row span { font-size: 13px; }
.performance-detail-row strong { text-align: right; }
.performance-detail-state { color: #667085; padding: 50px 10px; text-align: center; }
.performance-detail-state.error { color: #b42318; }

@media (max-width: 1300px) and (max-height: 760px) {
  .class-performance-view { padding: 7px; }
  .class-performance-header { border-radius: 10px; grid-template-columns: minmax(210px, 1fr) auto auto; min-height: 60px; padding: 7px 11px; }
  .class-performance-title-block h1 { font-size: 21px; }
  .class-performance-range { gap: 5px; margin-top: 3px; }
  .class-performance-week-badge { font-size: 13px; padding: 4px 7px; }
  .class-performance-range-dates { font-size: 11px; }
  .class-performance-range small { font-size: 10px; }
  .class-performance-timebar button,
  .class-performance-close { min-height: 30px; padding: 4px 8px; }
  .class-performance-timebar { grid-template-columns: repeat(4, minmax(82px, 1fr)); }
  .class-performance-tabs { margin-top: 5px; padding: 3px; }
  .class-performance-tabs button { font-size: 12px; min-height: 30px; }
  .performance-matrix-wrap { max-height: calc(100vh - 132px); }
  .performance-matrix th,
  .performance-matrix td { height: 38px; }
  .performance-person-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .performance-person-card { min-height: 66px; padding: 6px 8px; }
  .performance-attendance-board,
  .performance-project-ranking { max-height: calc(100vh - 151px); }
  .performance-attendance-board { gap: 7px; grid-template-columns: minmax(0, 2fr) minmax(188px, 1fr) minmax(188px, 1fr); }
  .attendance-zone h3 { min-height: 35px; padding: 5px 9px; }
  .attendance-zone-list { gap: 4px; padding: 6px; }
  .attendance-student-card { gap: 5px; grid-template-columns: 24px minmax(0, 1fr) auto; min-height: 29px; padding: 3px 6px; }
  .attendance-student-card strong { font-size: 12px; }
  .attendance-card-detail { font-size: 10px; }
  .performance-project-ranking-head,
  .performance-project-ranking button { min-height: 40px; padding: 5px 10px; }
}

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button {
  border: 0;
  font: inherit;
  cursor: pointer;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #f59e0b;
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
  padding: calc(18px + env(safe-area-inset-top)) 18px calc(18px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-x: hidden;
}

.topbar,
.workspace,
.seat-board,
.action-panel,
.classroom-footer {
  min-width: 0;
}

.external-leave-drawer {
  position: relative;
  min-width: 0;
}

.external-leave-status-button {
  width: auto;
  min-height: 38px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  background: transparent;
  font-weight: 900;
  text-align: left;
}

.external-leave-toggle-chevron {
  color: var(--muted);
  font-size: 13px;
  transition: transform .18s ease;
}

.external-leave-drawer.expanded .external-leave-toggle-chevron {
  transform: rotate(180deg);
}

.external-leave-status-dot {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border: 2px solid #98a2b3;
  border-radius: 50%;
  background: #cbd5e1;
  box-shadow: 0 0 0 3px rgba(152, 162, 179, .14);
}

.external-leave-drawer[data-connection-state='healthy'] .external-leave-status-dot {
  border-color: #0f6b4f;
  background: #20a474;
  box-shadow: 0 0 0 3px rgba(32, 164, 116, .16);
}

.external-leave-drawer[data-connection-state='error'] .external-leave-status-dot {
  border-color: #981b13;
  background: #d92d20;
  box-shadow: 0 0 0 3px rgba(217, 45, 32, .14);
}

.external-leave-drawer[data-connection-state='unknown'] .external-leave-status-dot {
  border-color: #98a2b3;
  background: #cbd5e1;
}

.external-leave-drawer[data-connection-state='loading'] .external-leave-status-dot {
  border-color: #1f4e79;
  border-right-color: transparent;
  background: #dce9f5;
  animation: external-leave-spin .75s linear infinite;
}

@keyframes external-leave-spin {
  to { transform: rotate(360deg); }
}

.external-leave-drawer-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 14;
  width: min(460px, calc(100vw - 36px));
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 16px 38px rgba(21, 32, 51, .18);
}

.external-leave-drawer-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding-top: 8px;
}

.external-leave-summary {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
  overflow: hidden;
  white-space: nowrap;
}

.external-leave-summary strong {
  overflow: hidden;
  text-overflow: ellipsis;
}

.external-leave-summary span {
  flex: 0 0 auto;
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
}

.external-leave-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.external-leave-actions button {
  min-height: 34px;
  padding: 0 10px;
}

.external-leave-meta {
  min-width: 0;
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
}

.external-leave-issue {
  min-width: 0;
  color: var(--red);
  overflow: hidden;
  text-overflow: ellipsis;
}

.external-leave-list {
  max-height: 128px;
  margin-top: 6px;
  display: grid;
  gap: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.external-leave-row {
  width: 100%;
  min-height: 28px;
  padding: 4px 9px;
  display: grid;
  grid-template-columns: minmax(100px, .55fr) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid #d8e3ed;
  border-radius: 6px;
  color: var(--ink);
  background: #f7fafc;
  text-align: left;
}

.external-leave-row span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.external-leave-empty {
  min-height: 30px;
  padding: 6px 9px;
  color: var(--muted);
  background: #f7f9fc;
}

.external-leave-evidence-dialog {
  width: min(640px, calc(100vw - 24px));
  padding: 0;
  border: 0;
  border-radius: 12px;
  color: var(--ink);
  background: transparent;
}

.external-leave-evidence-dialog::backdrop {
  background: rgba(15, 23, 42, .55);
}

.external-leave-evidence-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(15, 23, 42, .28);
}

.external-leave-evidence-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.external-leave-evidence-head h2 {
  margin: 4px 0 0;
  font-size: 22px;
}

.external-leave-evidence-source-mark {
  color: #a15c00;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: .08em;
}

.external-leave-evidence-grid {
  margin: 16px 0 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.external-leave-evidence-grid > div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f7f9fc;
}

.external-leave-evidence-grid dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.external-leave-evidence-grid dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  font-weight: 850;
}

.topbar {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-kicker {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

h1 {
  margin: 2px 0 0;
  font-size: 27px;
  letter-spacing: 0;
}

.status-strip,
.board-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.status-strip {
  min-width: 0;
}

.status-toolbar {
  min-width: 0;
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  white-space: nowrap;
}

.status-toolbar > * + * {
  border-left: 1px solid var(--line);
}

.status-sync-command {
  min-width: 72px;
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 0;
  color: var(--blue);
  background: #f4f8fc;
  font-weight: 900;
  white-space: nowrap;
}

.status-sync-command:disabled {
  color: #98a4b3;
  background: #f1f4f7;
}

.release-box {
  min-width: 0;
  min-height: 40px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.more-menu-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
}

.more-command {
  min-width: 42px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 0 8px 8px 0;
  box-shadow: none;
  font-size: 22px;
  line-height: 1;
}

.more-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  width: 260px;
  max-height: calc(100vh - 92px);
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 18px 46px rgba(15, 23, 42, .2);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.more-menu > button {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--ink);
  background: transparent;
  text-align: left;
  font-weight: 750;
}

.more-menu-setting {
  display: grid;
  gap: 5px;
  padding: 7px 10px 9px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.more-menu-setting select {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

.more-menu > button:hover,
.more-menu > button:focus-visible {
  background: #eef5fb;
}

.more-menu .danger-menu-item {
  margin-top: 6px;
  color: var(--red);
  background: var(--red-soft);
}

.legacy-device-panel {
  display: grid;
  gap: 5px;
  margin: 4px 0 8px;
  padding: 10px;
  border: 1px solid #cbd8e5;
  border-radius: 9px;
  background: #f6f9fc;
  color: var(--muted);
  font-size: 12px;
}

.legacy-device-panel strong {
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, monospace;
  overflow-wrap: anywhere;
}

.legacy-device-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 5px;
}

.legacy-device-actions button {
  min-height: 34px;
  border: 1px solid #c7d5e3;
  border-radius: 7px;
  color: var(--blue);
  background: #fff;
  font-weight: 750;
}

.release-status {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.15;
}

.release-status.current {
  color: var(--green);
}

.release-status.available,
.release-status.checking {
  color: var(--amber);
}

.release-status.failed,
.release-status.offline {
  color: var(--red);
}

.release-detail {
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}

.update-command {
  color: var(--blue);
  border-color: rgba(31, 78, 121, 0.28);
  background: #eef5fb;
}

.status-pill {
  min-width: 0;
  max-width: 190px;
  min-height: 40px;
  padding: 8px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill.online {
  color: var(--green);
  background: var(--green-soft);
}

.status-pill.warn {
  color: var(--amber);
  background: var(--amber-soft);
}

.linked-status {
  max-width: 155px;
  color: var(--blue);
  background: #eef5fb;
}

body:not(.classroom-active) .action-panel-tabs,
body:not(.classroom-active) .action-panel-page,
body:not(.classroom-active) .draw-counts,
body:not(.classroom-active) .draw-run,
body:not(.classroom-active) .draw-result,
body:not(.classroom-active) .draw-history {
  opacity: .58;
}

.icon-command,
.primary-command,
.secondary-command {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 15px;
  font-weight: 850;
  color: #ffffff;
  background: var(--blue);
  box-shadow: 0 8px 18px rgba(31, 78, 121, 0.18);
}

.secondary-command {
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: none;
}

.secondary-command.danger {
  color: var(--red);
  background: var(--red-soft);
  border-color: #ffd1cf;
}

button:disabled {
  cursor: wait;
  opacity: 0.58;
  box-shadow: none;
}

.initialization-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid #f3c483;
  border-radius: 8px;
  color: var(--amber);
  background: var(--amber-soft);
  font-size: 13px;
}

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 34%);
  gap: 14px;
  overflow-x: hidden;
}

.seat-board,
.action-panel,
.classroom-footer {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.action-panel > *,
.panel-head,
.score-summary-grid,
.attendance-actions,
.draw-panel,
.quick-actions {
  min-width: 0;
  max-width: 100%;
}


.seat-board {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.classroom-footer {
  min-height: 52px;
  padding: 7px 10px 7px 14px;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  overflow: visible;
}

.classroom-filing {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 16px;
}

.classroom-filing a {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
  text-decoration: none;
}

.classroom-filing a:hover,
.classroom-filing a:focus-visible {
  text-decoration: underline;
}

.classroom-filing img {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  object-fit: contain;
}

.classroom-footer-left {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.classroom-footer-leave {
  min-width: 0;
  justify-self: end;
}

.classroom-footer-copy {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
}

.classroom-footer .board-title,
.classroom-footer .board-sub {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.classroom-footer .board-title {
  flex: 0 1 auto;
  font-size: 18px;
}

.classroom-footer .board-sub {
  flex: 1 1 auto;
  margin-top: 0;
}

.classroom-headcount {
  flex: 0 0 auto;
  padding-left: 12px;
  border-left: 1px solid #d7e1ec;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .01em;
  white-space: nowrap;
}

.classroom-headcount-expected { color: var(--blue); }
.classroom-headcount-actual { color: var(--green); }
.classroom-headcount-separator { margin: 0 2px; color: var(--muted); }

.classroom-footer .board-tools {
  flex: 0 0 auto;
}

.board-title {
  font-size: 22px;
  font-weight: 900;
}

.board-sub {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.stage-label {
  height: 30px;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 900;
}

.session-controller {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(5, auto);
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fc;
}

.session-course-summary {
  min-width: 0;
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 0 10px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 850;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-controller > button {
  min-height: 42px;
  height: 42px;
  padding: 0 13px;
  white-space: nowrap;
}

.session-controller > #endSessionButton {
  justify-self: end;
  min-width: 64px;
  padding-left: 11px;
  padding-right: 11px;
}

.session-controller .classroom-headcount {
  padding-left: 0;
  border-left: 0;
}

.pairing-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 268px;
  gap: 28px;
  align-items: center;
  margin-bottom: 18px;
  padding: 26px;
  border: 1px solid #c9d9ea;
  border-radius: 20px;
  color: #fff;
  background: linear-gradient(135deg, #173a68 0%, #245c98 62%, #287569 100%);
  box-shadow: 0 18px 42px rgba(23, 58, 104, .18);
}

.pairing-panel[hidden] { display: none; }
.pairing-kicker { color: #bcebdc; font-size: 13px; font-weight: 800; letter-spacing: .16em; }
.pairing-copy h2 { margin: 8px 0 10px; font-size: clamp(24px, 2.2vw, 36px); }
.pairing-copy p { max-width: 720px; margin: 0; color: #dbeafe; font-size: 15px; line-height: 1.65; }
.pairing-note-item { display: flex; align-items: center; gap: 9px; }
.pairing-note-item::before { content: ''; width: 7px; height: 7px; flex: 0 0 7px; border-radius: 1px; background: #fff; box-shadow: 0 0 0 1px rgba(255,255,255,.18); }
.pairing-copy .text-command { margin-top: 18px; color: #fff; border-color: rgba(255,255,255,.35); background: rgba(255,255,255,.12); }
.pairing-panel-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pairing-status { margin-top: 14px; color: #d1fae5; font-weight: 750; }
.pairing-qr-wrap { justify-self: end; padding: 12px; border-radius: 18px; color: #475467; background: #fff; text-align: center; }
.pairing-qr-wrap canvas,
.pairing-qr-wrap img { display: block; width: 220px; height: 220px; object-fit: contain; image-rendering: pixelated; }
.pairing-qr-wrap canvas[hidden],
.pairing-qr-wrap img[hidden] { display: none; }
.pairing-expiry {
  display: block;
  min-height: 30px;
  margin-top: 8px;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--blue);
  background: #eaf2fb;
  font-size: 16px;
  font-weight: 900;
  line-height: 20px;
  letter-spacing: .02em;
}
.pairing-expiry.urgent { color: #b54708; background: #fff3df; }
.pairing-expiry.expired { color: #b42318; background: #fff1f0; }
.pairing-mini { display: inline-flex; align-items: center; gap: 9px; margin: 0 0 14px auto; padding: 10px 14px; border: 1px solid #b8cce0; border-radius: 999px; color: #173a68; background: #f2f7fc; font-weight: 800; }
.pairing-mini[hidden] { display: none; }
.pairing-mini small { color: #667085; font-weight: 600; }
.pairing-mini-icon { font-size: 22px; line-height: 1; }

.layout-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  background: #fff7ed;
}

.layout-tools[hidden] {
  display: none;
}

.layout-stepper {
  display: grid;
  grid-template-columns: auto 34px 28px 34px;
  align-items: center;
  gap: 6px;
  color: #9a3412;
  font-size: 13px;
  font-weight: 850;
}

.layout-stepper button {
  width: 34px;
  height: 34px;
  border: 1px solid #fdba74;
  border-radius: 7px;
  color: #c2410c;
  background: #fff;
  font-size: 18px;
  font-weight: 900;
}

#modeButton.arrange-active {
  border-color: #f97316;
  color: #c2410c;
  background: #fff7ed;
}

.seat-grid {
  --seat-name-size: 23px;
  --seat-number-size: 14px;
  --seat-cell-gap: 8px;
  --seat-cell-padding: 7px;
  --seat-stamp-size: 36px;
  flex: 1 1 auto;
  min-height: 360px;
  display: grid;
  gap: var(--seat-cell-gap);
  align-content: stretch;
}

.seat-cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: var(--seat-cell-padding);
  border-radius: 8px;
  border: 1px solid #d5dde6;
  background: #fbfcfe;
  display: grid;
  grid-template-rows: auto 1fr;
  align-items: center;
  touch-action: manipulation;
  user-select: none;
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.seat-evaluation-markers {
  position: absolute;
  right: 6px;
  bottom: 5px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 1px 4px rgba(15, 23, 42, .12);
}

.seat-evaluation-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .95);
}

.seat-evaluation-dot.positive { background: #16a34a; }
.seat-evaluation-dot.negative { background: #dc2626; }

.seat-cell:active {
  transform: scale(.98);
}

.seat-cell.empty {
  background: #f2f5f8;
  color: #9aa5b3;
  border-style: dashed;
}

.seat-cell.selected {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 2px rgba(31, 78, 121, 0.18);
  transform: translateY(-1px);
}

.seat-cell.gender-male:not(.empty) {
  border-color: #bfdbfe;
  background: linear-gradient(180deg, #fff 0%, #eff6ff 100%);
}

.seat-cell.gender-female:not(.empty) {
  border-color: #fbcfe8;
  background: linear-gradient(180deg, #fff 0%, #fdf2f8 100%);
}

.seat-cell.attendance-pending,
.seat-cell.attendance-leave,
.seat-cell.attendance-late,
.seat-cell.attendance-absent {
  border-style: dashed;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, .2);
}
.seat-cell.training {
  background: #e9edf2;
  border-color: #9aa4b2;
  color: #687385;
  filter: grayscale(.75);
}
.seat-cell.training .seat-no,
.seat-cell.training .seat-name { color: #687385; }

.seat-cell.attendance-pending .seat-no,
.seat-cell.attendance-pending .seat-name,
.seat-cell.attendance-leave .seat-no,
.seat-cell.attendance-leave .seat-name,
.seat-cell.attendance-late .seat-no,
.seat-cell.attendance-late .seat-name,
.seat-cell.attendance-absent .seat-no,
.seat-cell.attendance-absent .seat-name {
  opacity: .58;
  filter: grayscale(.45);
}

.seat-attendance-stamp {
  position: absolute;
  right: max(2px, calc(var(--seat-cell-padding) * .5));
  top: max(2px, calc(var(--seat-cell-padding) * .5));
  width: var(--seat-stamp-size);
  height: var(--seat-stamp-size);
  color: #b42318;
  transform: rotate(-8deg);
  pointer-events: none;
  z-index: 2;
}

.seat-attendance-stamp.pending,
.seat-attendance-stamp.absent { color: #b42318; }
.seat-attendance-stamp.late { color: #c2410c; }
.seat-attendance-stamp.leave { color: #7c3aed; }
.seat-attendance-stamp.training { color: #64748b; }

.seat-attendance-stamp.external-source {
  color: #6d28d9;
  pointer-events: auto;
  cursor: pointer;
}

.seat-attendance-source {
  position: absolute;
  right: -5px;
  bottom: -3px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: #6d28d9;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .24);
  font-size: 10px;
  font-weight: 950;
  line-height: 14px;
  text-align: center;
  transform: rotate(8deg);
}

.seat-attendance-stamp svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 1px 1px rgba(15, 23, 42, .1));
}

.seat-attendance-stamp-ring {
  stroke: currentColor;
}

.seat-attendance-stamp-ring.outer {
  fill: rgba(255, 255, 255, .9);
  stroke-width: 7;
}

.seat-attendance-stamp-ring.inner {
  fill: none;
  stroke-width: 3;
}

.seat-attendance-stamp-label {
  fill: currentColor;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 54px;
  font-weight: 950;
  text-anchor: middle;
  dominant-baseline: central;
}

.seat-cell.pulse {
  animation: pwa-seat-pulse .32s ease-out;
}

@keyframes pwa-seat-pulse {
  0% { transform: scale(.94); box-shadow: 0 0 0 0 rgba(31, 78, 121, .35); }
  100% { transform: scale(1); box-shadow: 0 0 0 12px rgba(31, 78, 121, 0); }
}

.seat-cell.moving {
  border-color: var(--green);
  background: var(--green-soft);
  transform: scale(1.02);
}

.seat-no {
  color: var(--muted);
  font-size: var(--seat-number-size);
  font-weight: 800;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.external-leave-data-notice {
  min-width: 0;
  color: var(--amber);
  overflow: hidden;
  text-overflow: ellipsis;
}

.seat-cell.student-number-compact .seat-no {
  font-size: max(10px, calc(var(--seat-number-size) * .86));
}

.seat-cell.student-number-dense .seat-no {
  font-size: max(8px, calc(var(--seat-number-size) * .7));
  letter-spacing: -.03em;
}

.seat-name {
  font-size: var(--seat-name-size);
  font-weight: 900;
  line-height: 1.08;
  text-align: center;
  overflow-wrap: anywhere;
}

.offstage {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.offstage-chip {
  padding: 7px 9px;
  border-radius: 8px;
  color: var(--amber);
  background: var(--amber-soft);
  font-size: 12px;
  font-weight: 800;
}

.action-panel {
  padding: 10px;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 8px;
  align-content: start;
  overflow: hidden;
}

.selected-student-summary {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(96px, auto) minmax(0, 1fr);
  align-items: start;
  gap: 8px;
}

.today-performance-panel {
  grid-column: 1 / -1;
  min-width: 0;
  padding: 5px 7px;
  border: 1px solid #dbe5ef;
  border-radius: 8px;
  background: #f8fafc;
}

.today-performance-panel[hidden] { display: none; }

.today-performance-head {
  min-height: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.today-performance-head.only-toggle { min-height: 0; justify-content: flex-end; }
.today-performance-head.only-toggle:has(.text-command[hidden]) { display: none; }
.today-performance-head .text-command { min-height: 24px; padding: 0 4px; font-size: 11px; }

.today-performance-list {
  max-height: 132px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.today-performance-row {
  min-height: 22px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px;
  border-top: 1px solid #e8eef5;
  font-size: 11px;
}

.today-performance-row time { color: var(--muted); }
.today-performance-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Classroom score confirmation: a brief, non-blocking spotlight visible from the back row. */
.evaluation-feedback {
  align-items: center;
  background: radial-gradient(circle at center, rgba(10, 31, 55, .18) 0 19%, rgba(10, 31, 55, .34) 43%, rgba(10, 31, 55, 0) 72%);
  display: flex;
  inset: 0;
  justify-content: center;
  overflow: hidden;
  pointer-events: none;
  position: fixed;
  z-index: 90;
}

.evaluation-feedback[hidden] { display: none; }

.evaluation-feedback-card {
  align-items: center;
  background: radial-gradient(circle at 48% 42%, rgba(41, 212, 153, .98) 0 26%, rgba(13, 139, 99, .94) 58%, rgba(6, 91, 66, .96) 100%);
  border: 3px solid rgba(218, 255, 241, .92);
  border-radius: 50%;
  box-shadow: 0 0 0 14px rgba(38, 198, 143, .16), 0 0 54px rgba(38, 233, 166, .82), inset 0 0 34px rgba(255, 255, 255, .2);
  color: #fff;
  display: flex;
  flex-direction: column;
  height: clamp(220px, 31vh, 310px);
  justify-content: center;
  min-width: 310px;
  padding: 26px 54px;
  position: relative;
  text-align: center;
  text-shadow: 0 3px 12px rgba(0, 38, 28, .38);
  width: clamp(350px, 36vw, 510px);
  animation: evaluation-feedback-pop 1.1s cubic-bezier(.18,.78,.22,1) both;
}

.evaluation-feedback.deduct .evaluation-feedback-card {
  background: radial-gradient(circle at 48% 42%, rgba(255, 116, 105, .98) 0 26%, rgba(207, 57, 48, .95) 58%, rgba(137, 25, 21, .97) 100%);
  border-color: rgba(255, 230, 227, .94);
  box-shadow: 0 0 0 14px rgba(239, 91, 81, .16), 0 0 54px rgba(255, 91, 78, .76), inset 0 0 34px rgba(255, 255, 255, .2);
  text-shadow: 0 3px 12px rgba(64, 4, 4, .4);
}

.evaluation-feedback.neutral .evaluation-feedback-card {
  background: radial-gradient(circle at 48% 42%, rgba(103, 151, 202, .98) 0 26%, rgba(53, 95, 139, .96) 58%, rgba(32, 65, 99, .98) 100%);
  border-color: rgba(231, 243, 255, .94);
  box-shadow: 0 0 0 14px rgba(74, 121, 171, .16), 0 0 54px rgba(91, 150, 211, .7), inset 0 0 34px rgba(255, 255, 255, .2);
}

.evaluation-feedback-card strong,
.evaluation-feedback-card b,
.evaluation-feedback-card span { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.evaluation-feedback-card strong { font-size: clamp(31px, 3.6vw, 51px); font-weight: 950; letter-spacing: .04em; }
.evaluation-feedback-card b { font-size: clamp(67px, 8vw, 112px); font-variant-numeric: tabular-nums; font-weight: 1000; letter-spacing: -.04em; line-height: .92; margin: 5px 0 8px; }
.evaluation-feedback-card span { font-size: clamp(19px, 2vw, 29px); font-weight: 850; }

.evaluation-feedback-glow { height: min(68vh, 610px); left: 50%; position: absolute; top: 50%; transform: translate(-50%, -50%); width: min(68vw, 760px); }
.evaluation-feedback-glow::before,
.evaluation-feedback-glow::after { color: #ceffed; content: '✦'; filter: drop-shadow(0 0 9px currentColor); font-size: clamp(31px, 4vw, 58px); left: 50%; position: absolute; top: 50%; }
.evaluation-feedback-glow::before { animation: evaluation-star-left 1.1s ease-out both; }
.evaluation-feedback-glow::after { animation: evaluation-star-right 1.1s ease-out both; }
.evaluation-feedback.deduct .evaluation-feedback-glow::before,
.evaluation-feedback.deduct .evaluation-feedback-glow::after { color: #ffe0dc; }
.evaluation-feedback.neutral .evaluation-feedback-glow::before,
.evaluation-feedback.neutral .evaluation-feedback-glow::after { color: #e0efff; }
.evaluation-feedback-glow i { background: currentColor; border-radius: 50%; box-shadow: 0 0 10px currentColor; color: #abffe0; height: 7px; left: 50%; position: absolute; top: 50%; width: 7px; animation: evaluation-spark 1.1s ease-out both; }
.evaluation-feedback-glow i:nth-child(1) { --spark-x: -280px; --spark-y: -120px; animation-delay: .03s; }
.evaluation-feedback-glow i:nth-child(2) { --spark-x: 270px; --spark-y: -145px; animation-delay: .08s; }
.evaluation-feedback-glow i:nth-child(3) { --spark-x: -330px; --spark-y: 30px; animation-delay: .12s; }
.evaluation-feedback-glow i:nth-child(4) { --spark-x: 325px; --spark-y: 55px; animation-delay: .05s; }
.evaluation-feedback-glow i:nth-child(5) { --spark-x: -220px; --spark-y: 165px; animation-delay: .1s; }
.evaluation-feedback-glow i:nth-child(6) { --spark-x: 235px; --spark-y: 170px; animation-delay: .14s; }
.evaluation-feedback.deduct .evaluation-feedback-glow i { color: #ffc7c1; }
.evaluation-feedback.neutral .evaluation-feedback-glow i { color: #d2e8ff; }

@keyframes evaluation-feedback-pop {
  0% { opacity: 0; transform: scale(.55); }
  18% { opacity: 1; transform: scale(1.08); }
  38% { transform: scale(.98); }
  76% { opacity: 1; transform: scale(1); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes evaluation-star-left { 0% { opacity: 0; transform: translate(-35px,-25px) rotate(-35deg) scale(.3); } 28%,75% { opacity: 1; } 100% { opacity: 0; transform: translate(-330px,-170px) rotate(60deg) scale(1.15); } }
@keyframes evaluation-star-right { 0% { opacity: 0; transform: translate(-15px,-15px) rotate(25deg) scale(.3); } 28%,75% { opacity: 1; } 100% { opacity: 0; transform: translate(285px,125px) rotate(110deg) scale(.95); } }
@keyframes evaluation-spark { 0% { opacity: 0; transform: translate(-50%,-50%) scale(.3); } 25% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--spark-x),var(--spark-y)) scale(1.15); } }

@media (prefers-reduced-motion: reduce) {
  .evaluation-feedback-card { animation: evaluation-feedback-fade 1.1s ease both; }
  .evaluation-feedback-glow { display: none; }
  @keyframes evaluation-feedback-fade { 0% { opacity: 0; } 15%,100% { opacity: 1; } }
}
.today-performance-row strong.positive { color: var(--green); }
.today-performance-row strong.negative { color: var(--red); }
.today-performance-row strong.neutral { color: var(--muted); }

.today-performance-empty {
  padding: 6px 0 2px;
  color: var(--muted);
  font-size: 11px;
}

.panel-title {
  font-size: 22px;
  font-weight: 900;
}

.panel-sub {
  color: var(--muted);
  font-size: 13px;
  margin-top: 5px;
}

.score-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.score-summary-grid[hidden] {
  display: none;
}

.score-summary-grid > div {
  min-height: 38px;
  padding: 6px 9px;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #dbe5ef;
  border-radius: 8px;
  background: #f7f9fc;
}

.score-summary-item {
  justify-content: space-between;
}

.score-summary-item.lesson {
  border-color: #dbeafe;
  background: #eff6ff;
}

.score-summary-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.score-summary-grid strong {
  margin-top: 0;
  color: var(--blue);
  font-size: 18px;
  font-weight: 950;
}

.score-summary-item.positive strong { color: var(--green); }
.score-summary-item.negative strong { color: var(--red); }
.score-summary-item.lesson strong { color: var(--blue); }

.attendance-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.action-panel-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  padding: 3px;
  border-radius: 8px;
  background: #edf3f8;
}

.action-panel-tab {
  min-width: 0;
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}

.action-panel-tab.active {
  color: #fff;
  background: var(--blue);
}

.action-panel-tab span {
  display: inline-flex;
  min-width: 17px;
  height: 17px;
  margin-left: 3px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: var(--red);
  background: #fff;
  font-size: 10px;
}

.action-panel-page[hidden] {
  display: none;
}

.action-panel-page {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.homework-workspace {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid #dbe5ef;
  border-radius: 10px;
  background: #f7f9fc;
  overflow: auto;
}

.homework-workspace[hidden] { display: none; }

.homework-workspace-head,
.homework-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.homework-workspace-head strong,
.homework-workspace-head span {
  display: block;
}

.homework-workspace-head strong { font-size: 18px; font-weight: 950; }
.homework-workspace-head span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.homework-loading,
.homework-empty { padding: 18px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); background: #fff; text-align: center; }
.homework-task-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.homework-task-card { min-width: 0; padding: 10px; display: grid; grid-template-columns: minmax(0, 1fr) max-content; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.homework-task-copy { min-width: 0; }
.homework-task-copy strong,
.homework-task-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.homework-task-copy strong { font-size: 15px; }
.homework-task-copy small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.homework-task-stats { margin-top: 7px; display: flex; flex-wrap: wrap; gap: 4px 8px; color: var(--blue); font-size: 10px; font-weight: 850; }
.homework-task-stats .warn { color: var(--red); }
.homework-side-panel {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.homework-side-workspace {
  width: 100%;
  max-height: 260px;
  padding: 8px;
  gap: 7px;
  overflow: auto;
}
.homework-side-workspace .homework-workspace-head { align-items: flex-start; }
.homework-side-workspace .homework-workspace-head strong { font-size: 14px; }
.homework-side-workspace .homework-task-list { grid-template-columns: minmax(0, 1fr); }
.homework-side-workspace .homework-empty,
.homework-side-workspace .homework-loading { padding: 12px 8px; font-size: 11px; }
.homework-side-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 5px;
}
.homework-side-actions button {
  width: auto;
  min-height: 30px;
  padding: 0 8px;
  font-size: 11px;
}

.homework-dialog {
  width: min(660px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
  box-shadow: 0 18px 52px rgba(15, 23, 42, .3);
}
.homework-dialog::backdrop { background: rgba(15, 23, 42, .42); backdrop-filter: blur(2px); }
.homework-dialog-card { padding: 18px; display: grid; gap: 12px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.homework-dialog-card h2 { margin: 0; font-size: 20px; }
.homework-dialog-card label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 800; }
.homework-dialog-card input,
.homework-dialog-card select { width: 100%; min-height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); font: inherit; }
.homework-dialog-card .homework-check { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.homework-check input { width: 18px; min-height: 18px; }
.homework-dialog-actions { display: flex; justify-content: flex-end; }
.homework-batch-dialog { width: min(920px, calc(100vw - 24px)); }
.homework-batch-card { max-height: calc(100vh - 24px); overflow: hidden; }
.homework-dialog-head p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.homework-batch-body { min-height: 0; display: grid; grid-template-columns: minmax(360px, 1.4fr) minmax(250px, 1fr); gap: 10px; overflow: hidden; }
.homework-student-list { min-height: 0; max-height: 62vh; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; overflow: auto; }
.homework-student-row { position: relative; min-width: 0; min-height: 42px; padding: 5px 13px 5px 7px; display: grid; grid-template-columns: 28px minmax(0, 1fr) max-content; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: #f9fbfd; text-align: left; }
.homework-student-row.student-number-compact { grid-template-columns: 48px minmax(0, 1fr) max-content; }
.homework-student-row.student-number-dense { grid-template-columns: 76px minmax(0, 1fr) max-content; }
.homework-student-row strong,
.homework-student-row em { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.homework-student-row em { color: var(--blue); font-size: 10px; font-style: normal; }
.homework-student-row.active { border-color: var(--blue); background: #eaf3fb; box-shadow: 0 0 0 2px rgba(31,78,121,.12); }
.homework-student-row.dirty::after { content: '•'; position: absolute; right: 5px; bottom: 2px; color: var(--amber); font-size: 13px; line-height: 1; pointer-events: none; }
.homework-student-no { min-width: 0; max-width: 100%; color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.homework-student-row.student-number-compact .homework-student-no { font-size: 9px; }
.homework-student-row.student-number-dense .homework-student-no { font-size: 8px; letter-spacing: -.03em; }
.homework-score-panel { min-width: 0; padding: 10px; display: flex; flex-direction: column; gap: 9px; border: 1px solid var(--line); border-radius: 9px; background: #f7f9fc; }
.homework-readonly-result { white-space: pre-line; line-height: 2; overflow-wrap: anywhere; }
.homework-score-options,
.homework-status-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.homework-entry-stages { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.homework-entry-stages button { min-width: 0; min-height: 36px; padding: 4px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: #fff; font-size: 11px; font-weight: 850; }
.homework-entry-stages button.active { border-color: var(--blue); color: #fff; background: var(--blue); }
.homework-score-options button,
.homework-status-options button { min-width: 0; min-height: 38px; border: 1px solid var(--line); border-radius: 7px; color: var(--blue); background: #fff; font-weight: 850; }
.homework-status-options button { color: var(--amber); }
.homework-numeric-entry { min-height: 40px; display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--line); color: var(--blue); font-size: 24px; font-variant-numeric: tabular-nums; }
.homework-inline-keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.homework-inline-keypad button { min-height: 38px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: #fff; font-size: 17px; font-weight: 850; }
.homework-save-batch { margin-top: auto; width: 100%; }

.lesson-end-dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
  box-shadow: 0 18px 52px rgba(15, 23, 42, .3);
}

.lesson-end-dialog::backdrop {
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(2px);
}

.lesson-end-dialog-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  text-align: center;
}

.lesson-end-dialog-card h2 {
  margin: 0;
  color: var(--ink);
  font-size: 21px;
}

.lesson-end-dialog-card p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.lesson-end-dialog-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}

.lesson-end-dialog-actions[hidden] {
  display: none;
}

.maintenance-advanced {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  text-align: left;
}

.maintenance-advanced summary { cursor: pointer; color: var(--muted); }
.maintenance-advanced .danger-menu-item { margin-top: 12px; color: var(--red); background: #fff1f0; }

.attendance-chip {
  flex: 1 1 0;
  min-width: 0;
  min-height: 36px;
  padding: 5px 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: #f7f9fc;
  font-size: 11px;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attendance-chip.active {
  border-color: var(--blue);
  color: var(--blue);
  background: #eef5fb;
}

.attendance-chip.deduct {
  color: var(--red);
  background: var(--red-soft);
}

.attendance-chip.pending {
  color: #92400e;
  background: #fffbeb;
  border-color: #fbbf24;
}

.attendance-chip.active.deduct {
  border-color: #b91c1c;
  color: #fff;
  background: #dc2626;
}

.attendance-chip.active.pending {
  border-color: #b45309;
  color: #fff;
  background: #d97706;
}

.attendance-cancel {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  color: #64748b;
  background: #f8fafc;
  font-size: 10px;
  font-weight: 850;
  white-space: nowrap;
}

.attendance-chip:disabled {
  opacity: .45;
}

.draw-panel {
  padding: 8px;
  border: 1px solid #dbe5ef;
  border-radius: 8px;
  background: #f9fbfd;
}

.draw-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.draw-head strong,
.draw-head span {
  display: block;
}

.draw-head strong {
  font-size: 15px;
  font-weight: 900;
}

.draw-head span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.text-command {
  padding: 4px 6px;
  color: var(--blue);
  background: transparent;
  font-size: 12px;
  font-weight: 850;
}

.draw-counts {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 4px;
  margin-top: 7px;
}

.draw-count {
  min-width: 0;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  font-weight: 850;
}

.draw-count.active {
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
}

.draw-run {
  width: 100%;
  margin-top: 6px;
}

.draw-result {
  height: 34px;
  min-height: 34px;
  margin-top: 6px;
  display: block;
  padding: 0 8px;
  border-radius: 7px;
  color: var(--blue);
  background: #eef5fb;
  font-size: 14px;
  font-weight: 950;
  line-height: 34px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.draw-history {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.draw-floating {
  position: fixed;
  right: 14px;
  bottom: 74px;
  z-index: 30;
  width: clamp(320px, calc(34vw - 20px), 460px);
  border: 1px solid #bfd1e2;
  border-radius: 10px;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 18px 42px rgba(15, 23, 42, .2);
  overflow: hidden;
  touch-action: none;
}

.draw-floating.collapsed .draw-floating-list {
  display: none !important;
}

.draw-floating-head {
  min-height: 36px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #fff;
  background: #1f4e79;
  cursor: move;
  user-select: none;
}

.draw-floating-head .text-command {
  color: #fff;
}

.draw-floating-actions { display: flex; align-items: center; gap: 6px; }

.draw-close-button {
  width: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 6px;
  color: #fff;
  background: rgba(255,255,255,.12);
  font-size: 20px;
  line-height: 1;
}

.draw-floating.collapsed #desktopFloatButton { display: none !important; }

.draw-floating-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  padding: 7px;
}

.draw-floating-student {
  min-width: 0;
  min-height: 32px;
  border: 1px solid #cddbe8;
  border-radius: 7px;
  color: var(--blue);
  background: #f3f8fc;
  font-size: 13px;
  font-weight: 900;
}

.draw-floating-student.active {
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
  box-shadow: 0 0 0 2px rgba(31, 78, 121, .16);
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  align-content: start;
}

.panel-empty {
  grid-column: 1 / -1;
  min-height: 58px;
  padding: 12px;
  border-radius: 8px;
  border: 1px dashed var(--line);
  color: var(--muted);
  background: #f7f9fc;
  font-size: 13px;
  line-height: 1.5;
}

.attendance-chip.external-leave-readonly {
  color: #6d28d9;
  background: #f3e8ff;
  border-color: #c4b5fd;
}

.attendance-external-hint {
  grid-column: 1 / -1;
  padding: 7px 9px;
  border: 1px solid #ddd6fe;
  border-radius: 7px;
  color: #5b21b6;
  background: #faf5ff;
  font-size: 11px;
  line-height: 1.45;
}
.attendance-training-hint {
  align-items: center;
  background: #eef1f5;
  border: 1px solid #aab2bf;
  border-radius: 12px;
  color: #596273;
  display: flex;
  font-weight: 700;
  justify-content: center;
  min-height: 54px;
  padding: 8px 14px;
}

.external-leave-score-notice {
  color: #5b21b6;
  border-color: #ddd6fe;
  background: #faf5ff;
}

.quick-btn {
  min-width: 0;
  min-height: 42px;
  border-radius: 8px;
  padding: 6px;
  font-size: 14px;
  font-weight: 950;
  color: var(--green);
  background: var(--green-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-btn.deduct {
  color: var(--red);
  background: var(--red-soft);
}

.quick-btn.neutral {
  color: #475467;
  background: #eef2f6;
  border: 1px solid #cbd5e1;
}

.quick-btn:disabled {
  color: #9aa5b3;
  background: #edf1f5;
  border-color: transparent;
}

@media (min-width: 761px) and (max-height: 840px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .app-shell {
    height: 100vh;
    min-height: 0;
    padding: 8px 10px;
    gap: 6px;
    overflow: hidden;
  }

  .topbar {
    min-height: 44px;
    gap: 10px;
  }

  .brand-kicker { font-size: 11px; }
  h1 { margin-top: 0; font-size: 23px; }
  .release-box { min-height: 36px; padding: 4px 8px; }
  .status-toolbar { border-radius: 8px; }
  .status-pill { min-height: 34px; padding: 6px 9px; }
  .status-sync-command { min-width: 62px; min-height: 34px; padding: 0 8px; font-size: 12px; }
  .status-toolbar .icon-command { min-height: 34px; }
  .initialization-notice { padding: 6px 9px; font-size: 12px; }

  .workspace {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 34%);
    gap: 8px;
    overflow: hidden;
  }

  .seat-board,
  .action-panel {
    height: 100%;
    min-height: 0;
    border-radius: 7px;
  }

  .seat-board {
    padding: 9px;
    gap: 6px;
    overflow: hidden;
  }

  .classroom-footer {
    min-height: 44px;
    padding: 5px 7px 5px 10px;
    gap: 8px;
  }

  .external-leave-status-button { min-height: 32px; padding: 4px 9px; font-size: 12px; }
  .external-leave-status-dot { width: 15px; height: 15px; flex-basis: 15px; }
  .external-leave-drawer-panel { width: min(420px, calc(100vw - 24px)); padding: 8px; }
  .external-leave-drawer-head { gap: 7px; padding-top: 5px; }
  .external-leave-actions button { min-height: 30px; padding: 0 8px; font-size: 11px; }
  .external-leave-meta { margin-top: 3px; font-size: 10px; }
  .external-leave-list { max-height: 112px; margin-top: 4px; gap: 3px; }
  .external-leave-row { min-height: 25px; padding: 3px 7px; font-size: 11px; }
  .external-leave-row span { font-size: 10px; }

  .classroom-footer-left { gap: 6px; }
  .classroom-footer-copy { gap: 6px; }
  .classroom-footer .board-title { font-size: 16px; }
  .classroom-footer .board-sub { font-size: 10px; }
  .classroom-headcount { padding-left: 8px; font-size: 11px; }

  .board-title { font-size: 19px; }
  .board-sub { margin-top: 2px; font-size: 11px; }
  .board-tools { gap: 5px; }
  .primary-command,
  .secondary-command { min-height: 34px; padding: 0 10px; }

  .session-controller {
    gap: 6px;
    padding: 6px;
  }

  .session-course-summary { min-height: 34px; padding: 0 6px; font-size: 15px; }
  .session-controller { grid-template-columns: minmax(0, 1fr) repeat(5, auto); gap: 4px; padding: 5px; }
  .session-controller > button { min-height: 32px; height: 32px; padding: 0 6px; font-size: 10px; }
  .session-controller .classroom-headcount { font-size: 10px; }
  .layout-tools { gap: 6px; padding: 6px; }
  .layout-stepper { grid-template-columns: auto 30px 24px 30px; gap: 4px; }
  .layout-stepper button { width: 30px; height: 30px; }
  .stage-label { height: 24px; font-size: 12px; }
  .seat-grid { min-height: 0; gap: var(--seat-cell-gap); }
  .seat-cell { min-height: 0; padding: var(--seat-cell-padding); border-radius: 6px; }
  .seat-no { font-size: var(--seat-number-size); }
  .seat-name { font-size: var(--seat-name-size); line-height: 1.08; }
  .seat-evaluation-markers { right: 4px; bottom: 3px; }

  .action-panel {
    padding: 8px;
    gap: 5px;
    overflow: hidden;
  }

  .selected-student-summary { gap: 5px; }
  .today-performance-panel { padding: 3px 5px; }
  .today-performance-list { max-height: 54px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; }
  .today-performance-row { min-height: 20px; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 2px; border: 1px solid #e8eef5; border-radius: 4px; padding: 0 2px; font-size: 8px; }
  .today-performance-head { min-height: 16px; }
  .today-performance-head strong { font-size: 11px; }
  .today-performance-head .text-command { min-height: 20px; }
  .today-performance-empty { grid-column: 1 / -1; min-height: 18px; padding: 2px 0 0; }
  .panel-title { font-size: 18px; }
  .panel-sub { margin-top: 2px; font-size: 11px; }
  .score-summary-grid { gap: 4px; }
  .score-summary-grid > div { min-height: 32px; padding: 4px 6px; gap: 4px; }
  .score-summary-grid span { font-size: 10px; }
  .score-summary-grid strong { margin-top: 0; font-size: 16px; }
  .attendance-chip { min-height: 44px; padding: 5px 4px; font-size: 11px; }
  .action-panel-tab { min-height: 32px; font-size: 12px; }
  .draw-panel { padding: 6px; }
  .draw-head strong { font-size: 13px; }
  .draw-head span { margin-top: 1px; font-size: 10px; }
  .draw-counts { margin-top: 4px; gap: 3px; }
  .draw-count { min-height: 20px; height: 20px; font-size: 10px; }
  .draw-run { min-height: 32px; margin-top: 3px; }
  #resetDrawButton { min-height: 32px; padding: 0 8px; }
  .draw-result { height: 20px; min-height: 20px; margin-top: 3px; font-size: 10px; line-height: 20px; }
  .draw-history { margin-top: 3px; font-size: 9px; }
  .quick-actions { gap: 5px; }
  .quick-btn { min-height: 44px; padding: 5px; font-size: 12px; }
  .homework-workspace { gap: 6px; padding: 8px; }
  .homework-workspace-head strong { font-size: 15px; }
  .homework-task-list { gap: 5px; }
  .homework-task-card { padding: 7px; }
  .homework-task-copy strong { font-size: 13px; }
  .homework-task-stats { margin-top: 4px; }
  .homework-batch-card { padding: 10px; gap: 7px; }
  .homework-student-list { max-height: 66vh; }
  .homework-student-row { min-height: 36px; }

  .draw-floating { right: 10px; bottom: 58px; }
  .draw-floating-list { gap: 4px; padding: 6px; }
  .draw-floating-student { min-height: 30px; font-size: 12px; }

  .pairing-panel {
    grid-template-columns: minmax(0, 1fr) 190px;
    gap: 14px;
    margin-bottom: 6px;
    padding: 14px;
    border-radius: 14px;
  }

  .pairing-copy h2 { margin: 4px 0 6px; font-size: 25px; }
  .pairing-copy p { font-size: 12px; line-height: 1.45; }
  .pairing-status { margin-top: 8px; font-size: 12px; }
  .pairing-copy .text-command { margin-top: 8px; }
  .pairing-qr-wrap { padding: 8px; border-radius: 12px; }
  .pairing-qr-wrap canvas,
  .pairing-qr-wrap img { width: 160px; height: 160px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media (max-width: 1100px) {
  .app-shell { padding-left: 10px; padding-right: 10px; }
  .workspace { grid-template-columns: minmax(0, 1fr) minmax(300px, 34%); gap: 9px; }
  .status-strip { gap: 0; }
  .status-pill { padding-left: 8px; padding-right: 8px; }
  .release-detail { display: none; }
  .linked-status { max-width: 128px; font-size: 11px; }
}

@media (max-width: 760px),
  (min-width: 761px) and (max-width: 960px) and (min-height: 841px) {
  .pairing-panel { grid-template-columns: 1fr; }
  .pairing-qr-wrap { justify-self: center; }
  .workspace {
    grid-template-columns: 1fr;
  }

  .action-panel {
    position: sticky;
    bottom: 0;
    z-index: 5;
  }

  .session-controller {
    grid-template-columns: minmax(0, 1fr) max-content;
  }
}

@media (max-width: 540px) {
  .app-shell {
    padding-left: 10px;
    padding-right: 10px;
  }

  .topbar,
  .session-controller {
    align-items: stretch;
    flex-direction: column;
  }

  .classroom-footer {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .classroom-footer-left {
    align-items: stretch;
    flex-direction: column;
    overflow: visible;
  }

  .classroom-footer-leave {
    justify-self: stretch;
  }

  .external-leave-status-button {
    width: 100%;
  }

  .external-leave-drawer-panel {
    right: auto;
    left: 0;
    width: min(460px, calc(100vw - 20px));
  }

  .session-controller {
    display: flex;
  }

  .classroom-footer-copy {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .external-leave-drawer-head,
  .external-leave-evidence-grid {
    grid-template-columns: 1fr;
  }

  .external-leave-actions {
    justify-content: stretch;
  }

  .external-leave-actions button {
    flex: 1;
  }

  .external-leave-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
    white-space: normal;
  }

  h1 {
    font-size: 24px;
  }

  .status-strip {
    justify-content: flex-start;
  }

  .seat-grid {
    gap: 6px;
  }

  .seat-cell {
    min-height: 66px;
    padding: 7px;
  }

  .seat-name {
    font-size: 14px;
  }

  .quick-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .quick-btn {
    min-height: 58px;
    font-size: 15px;
    padding: 8px;
  }
}
