:root {
  --bg: #f4f8fb;
  --panel: #ffffff;
  --panel-soft: #f8fcff;
  --line: #d8e4ec;
  --line-strong: #b9c9d6;
  --text: #1f2a37;
  --muted: #667085;
  --primary: #1e88a8;
  --primary-dark: #156779;
  --green: #2f855a;
  --amber: #a15c07;
  --red: #b42318;
  --cyan: #0f766e;
  --orange: #ef7b45;
  --pink: #c3487a;
  --shadow: 0 14px 34px rgba(31, 42, 55, 0.1);
  --sidebar-deep: #103f49;
  --sidebar-mid: #155865;
  --canvas-cool: #f2f7f9;
  --success-fresh: #2d8a61;
  --warning-coral: #d96752;
  --control-height: 42px;
}

.chat-stream-fixed {
  height: min(78vh, 820px);
  min-height: 600px;
  overflow-y: auto;
}

.focus-list-scroll {
  max-height: 340px;
}

/* Score table readability pass: final overrides for stronger scroll controls and two-by-two metrics. */
.student-table th {
  text-align: center;
  vertical-align: middle;
}

.score-scroll-shell {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 46px;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}

.score-scroll-shell-bottom {
  margin-top: 10px;
}

.score-scroll-top,
.score-scroll-bottom {
  height: 34px;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid #c7dde7;
  border-radius: 999px;
  background: #f2f8fb;
  scrollbar-width: auto;
  scrollbar-color: #167c91 #dcecf2;
}

.score-scroll-top::before {
  content: none !important;
}

.score-scroll-top > div,
.score-scroll-bottom > div {
  height: 1px;
}

.score-scroll-top::-webkit-scrollbar,
.score-scroll-bottom::-webkit-scrollbar,
.score-table-wrap::-webkit-scrollbar {
  height: 18px;
}

.score-scroll-top::-webkit-scrollbar-track,
.score-scroll-bottom::-webkit-scrollbar-track,
.score-table-wrap::-webkit-scrollbar-track {
  background: #dcecf2;
  border-radius: 999px;
}

.score-scroll-top::-webkit-scrollbar-thumb,
.score-scroll-bottom::-webkit-scrollbar-thumb,
.score-table-wrap::-webkit-scrollbar-thumb {
  min-width: 72px;
  background: linear-gradient(90deg, #14869a, #0f6f84);
  border: 3px solid #dcecf2;
  border-radius: 999px;
}

.score-scroll-arrow {
  width: 46px;
  height: 34px;
  border: 1px solid #0f7f94;
  border-radius: 10px;
  background: linear-gradient(180deg, #f5fcff, #dff2f7);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(15, 111, 132, 0.16);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.score-scroll-arrow:hover {
  background: linear-gradient(180deg, #ffffff, #ccebf2);
  box-shadow: 0 5px 14px rgba(15, 111, 132, 0.24);
  transform: translateY(-1px);
}

.score-scroll-arrow span {
  position: relative;
  display: block;
  width: 25px;
  height: 3px;
  border-radius: 999px;
  background: #0b5f72;
}

.score-scroll-arrow-right span::after,
.score-scroll-arrow-left span::before {
  content: "";
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  border-color: #0b5f72;
  border-style: solid;
}

.score-scroll-arrow-right span::after {
  right: -1px;
  border-width: 3px 3px 0 0;
  transform: translateY(-50%) rotate(45deg);
}

.score-scroll-arrow-left span::before {
  left: -1px;
  border-width: 0 0 3px 3px;
  transform: translateY(-50%) rotate(45deg);
}

.score-table-wrap:has(.detailed-score-table) {
  overflow-x: auto;
}

.detailed-score-table {
  width: max-content;
  max-width: none;
  table-layout: fixed;
  font-size: 14px;
}

.detailed-score-table .score-col-total {
  width: 180px;
}

.detailed-score-table .score-col-rank {
  width: 148px;
}

.detailed-score-table .score-col-subject {
  width: 190px;
}

.detailed-score-table th,
.detailed-score-table td {
  font-size: 14px;
  line-height: 1.45;
  white-space: nowrap;
  overflow: visible;
  word-break: normal;
  overflow-wrap: normal;
  padding: 8px 10px;
  vertical-align: middle;
}

.detailed-score-table th {
  font-size: 14.5px;
  text-align: center;
}

.detailed-score-table .score-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 8px;
  align-items: center;
  width: 100%;
}

.detailed-score-table .score-stack > *:not(:last-child)::after {
  content: none;
}

.detailed-score-table .score-cell-line {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  min-width: 0;
  color: #365365;
  font-size: 13.5px;
  white-space: nowrap;
}

.detailed-score-table .score-cell-line b {
  flex: 0 0 auto;
  min-width: 2.1em;
  color: #516b7a;
  font-weight: 700;
}

.detailed-score-table .score-field-button {
  justify-content: center;
  gap: 3px;
  font-size: 13.5px;
  white-space: nowrap;
  flex-wrap: nowrap;
}

.detailed-score-table .score-field-button strong {
  font-size: 14.5px;
}

.detailed-score-table .score-trend {
  font-size: 12.5px;
}

/* Final viewport-layer and dashboard/student-list guard. Keep this at EOF. */
.topbar {
  z-index: 90 !important;
  background: #fff !important;
  box-shadow: 0 1px 0 var(--line);
}

.detailed-score-table .score-freeze {
  z-index: 20 !important;
}

.detailed-score-table th.score-freeze {
  z-index: 25 !important;
}

.student-table th,
.student-table td {
  text-align: center !important;
  vertical-align: middle !important;
}

.student-table .student-main {
  justify-content: center;
  align-items: center;
  text-align: center;
}

.student-table .row-tags,
.student-table .row-actions {
  justify-content: center;
}

.dashboard-reminder-item,
.dashboard-watch-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  cursor: default;
}

.dashboard-card-main {
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  text-align: left;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  cursor: pointer;
}

.dashboard-card-delete {
  white-space: nowrap;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.section-actions .dashboard-watch-controls {
  margin: 0;
}

/* Score table frozen columns must keep identical geometry in every toggle mode.
   Only the scrollable subject/rank area may change when raw/elective fields hide. */
.detailed-score-table.score-no-raw.score-no-elective .score-col-subjects {
  width: 130px !important;
}

.detailed-score-table.score-no-raw.score-no-elective .score-col-total {
  width: 150px !important;
}

.detailed-score-table.score-no-raw.score-no-elective .score-freeze-total {
  left: 306px !important;
}

/* Modal layers must always sit above sticky score table cells. */
.modal-backdrop,
.student-detail-backdrop {
  z-index: 1000 !important;
}

/* Absolute final score-table guard at EOF: keep total sticky and seal fixed-column seams in every toggle mode. */
.score-table-wrap:has(.detailed-score-table) {
  overflow-x: auto !important;
  overflow-y: visible !important;
}

.detailed-score-table {
  width: max-content !important;
  max-width: none !important;
  table-layout: fixed !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  background: #ffffff !important;
}

.detailed-score-table .score-col-no { width: 88px !important; }
.detailed-score-table .score-col-name { width: 88px !important; }
.detailed-score-table .score-col-subjects { width: 130px !important; }
.detailed-score-table .score-col-total { width: 150px !important; }
.detailed-score-table .score-col-rank { width: 112px !important; }
.detailed-score-table .score-col-subject { width: 150px !important; }

.detailed-score-table:not(.score-no-raw) .score-col-total { width: 160px !important; }
.detailed-score-table:not(.score-no-raw) .score-col-subject { width: 160px !important; }


.detailed-score-table.score-no-raw.score-no-elective .score-col-subject { width: 140px !important; }

.detailed-score-table th,
.detailed-score-table td {
  box-sizing: border-box !important;
  text-align: center !important;
  vertical-align: middle !important;
  border-right: 1px solid #7f8a93 !important;
  border-bottom: 1px solid #7f8a93 !important;
  background-clip: padding-box !important;
}

.detailed-score-table th:first-child,
.detailed-score-table td:first-child {
  border-left: 1px solid #7f8a93 !important;
}

.detailed-score-table .score-stack {
  display: grid !important;
  grid-template-columns: repeat(2, max-content) !important;
  justify-content: center !important;
  justify-items: center !important;
  align-items: center !important;
  gap: 4px 8px !important;
  width: 100% !important;
}

.detailed-score-table .score-cell-line,
.detailed-score-table .score-field-button,
.detailed-score-table .score-sort-head,
.detailed-score-table .score-sort-head > div {
  justify-content: center !important;
  justify-items: center !important;
  align-items: center !important;
  text-align: center !important;
}

.detailed-score-table .score-field-button {
  margin: 0 auto !important;
}

.detailed-score-table .score-freeze {
  position: sticky !important;
  background: #ffffff !important;
  z-index: 30 !important;
  border-right: 1px solid #6f7a83 !important;
  box-shadow: 2px 0 0 #6f7a83 !important;
}

.detailed-score-table th.score-freeze {
  background: #eef8fb !important;
  z-index: 40 !important;
}

.detailed-score-table .score-freeze-no { left: 0 !important; }
.detailed-score-table .score-freeze-name { left: 88px !important; }
.detailed-score-table .score-freeze-subjects { left: 176px !important; }
.detailed-score-table .score-freeze-total { left: 306px !important; }

.detailed-score-table.score-no-raw.score-no-elective .score-freeze-subjects { left: 176px !important; }


.detailed-score-table .score-freeze-total {
  border-right: 3px solid #5f6972 !important;
  box-shadow: 4px 0 0 #5f6972 !important;
}

/* Absolute final score-table guard: keep total sticky and seal fixed-column seams in every toggle mode. */
.score-table-wrap:has(.detailed-score-table) {
  overflow-x: auto !important;
  overflow-y: visible !important;
}

.detailed-score-table {
  width: max-content !important;
  max-width: none !important;
  table-layout: fixed !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  background: #ffffff !important;
}

.detailed-score-table .score-col-no { width: 88px !important; }
.detailed-score-table .score-col-name { width: 88px !important; }
.detailed-score-table .score-col-subjects { width: 130px !important; }
.detailed-score-table .score-col-total { width: 150px !important; }
.detailed-score-table .score-col-rank { width: 112px !important; }
.detailed-score-table .score-col-subject { width: 150px !important; }

.detailed-score-table:not(.score-no-raw) .score-col-total { width: 160px !important; }
.detailed-score-table:not(.score-no-raw) .score-col-subject { width: 160px !important; }


.detailed-score-table.score-no-raw.score-no-elective .score-col-subject { width: 140px !important; }

.detailed-score-table th,
.detailed-score-table td {
  box-sizing: border-box !important;
  text-align: center !important;
  vertical-align: middle !important;
  border-right: 1px solid #7f8a93 !important;
  border-bottom: 1px solid #7f8a93 !important;
  background-clip: padding-box !important;
}

.detailed-score-table th:first-child,
.detailed-score-table td:first-child {
  border-left: 1px solid #7f8a93 !important;
}

.detailed-score-table .score-stack {
  display: grid !important;
  grid-template-columns: repeat(2, max-content) !important;
  justify-content: center !important;
  justify-items: center !important;
  align-items: center !important;
  gap: 4px 8px !important;
  width: 100% !important;
}

.detailed-score-table .score-cell-line,
.detailed-score-table .score-field-button,
.detailed-score-table .score-sort-head,
.detailed-score-table .score-sort-head > div {
  justify-content: center !important;
  justify-items: center !important;
  align-items: center !important;
  text-align: center !important;
}

.detailed-score-table .score-field-button {
  margin: 0 auto !important;
}

.detailed-score-table .score-freeze {
  position: sticky !important;
  background: #ffffff !important;
  z-index: 30 !important;
  border-right: 1px solid #6f7a83 !important;
  box-shadow: 2px 0 0 #6f7a83 !important;
}

.detailed-score-table th.score-freeze {
  background: #eef8fb !important;
  z-index: 40 !important;
}

.detailed-score-table .score-freeze-no { left: 0 !important; }
.detailed-score-table .score-freeze-name { left: 88px !important; }
.detailed-score-table .score-freeze-subjects { left: 176px !important; }
.detailed-score-table .score-freeze-total { left: 306px !important; }

.detailed-score-table.score-no-raw.score-no-elective .score-freeze-subjects { left: 176px !important; }


.detailed-score-table .score-freeze-total {
  border-right: 3px solid #5f6972 !important;
  box-shadow: 4px 0 0 #5f6972 !important;
}

/* Final score-table correction: compact elective mode, centered cells, opaque sticky seams. */
.score-table-wrap:has(.detailed-score-table) {
  overflow-x: auto !important;
  overflow-y: visible !important;
}

.detailed-score-table {
  width: max-content !important;
  max-width: none !important;
  table-layout: fixed !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  background: #ffffff !important;
}

.detailed-score-table .score-col-no { width: 88px !important; }
.detailed-score-table .score-col-name { width: 88px !important; }
.detailed-score-table .score-col-subjects { width: 130px !important; }
.detailed-score-table .score-col-total { width: 150px !important; }
.detailed-score-table .score-col-rank { width: 112px !important; }
.detailed-score-table .score-col-subject { width: 150px !important; }

.detailed-score-table:not(.score-no-raw) .score-col-total { width: 170px !important; }
.detailed-score-table:not(.score-no-raw) .score-col-subject { width: 182px !important; }


.detailed-score-table.score-no-raw.score-no-elective .score-col-rank { width: 112px !important; }
.detailed-score-table.score-no-raw.score-no-elective .score-col-subject { width: 140px !important; }

.detailed-score-table th,
.detailed-score-table td {
  text-align: center !important;
  vertical-align: middle !important;
  border-right: 1px solid #7f8a93 !important;
  border-bottom: 1px solid #7f8a93 !important;
  background-clip: padding-box !important;
}

.detailed-score-table th:first-child,
.detailed-score-table td:first-child {
  border-left: 1px solid #7f8a93 !important;
}

.detailed-score-table .score-stack {
  display: grid !important;
  grid-template-columns: repeat(2, max-content) !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 4px 8px !important;
  width: 100% !important;
}

.detailed-score-table .score-cell-line,
.detailed-score-table .score-field-button,
.detailed-score-table .score-sort-head,
.detailed-score-table .score-sort-head > div {
  justify-content: center !important;
  align-items: center !important;
  text-align: center !important;
}

.detailed-score-table .score-field-button {
  margin: 0 auto !important;
}

.detailed-score-table .score-freeze {
  position: sticky !important;
  background: #ffffff !important;
  z-index: 8 !important;
  border-right: 1px solid #6f7a83 !important;
  box-shadow: 2px 0 0 #6f7a83 !important;
}

.detailed-score-table th.score-freeze {
  background: #eef8fb !important;
  z-index: 12 !important;
}

.detailed-score-table .score-freeze-no { left: 0 !important; }
.detailed-score-table .score-freeze-name { left: 88px !important; }
.detailed-score-table .score-freeze-subjects { left: 176px !important; }
.detailed-score-table .score-freeze-total { left: 306px !important; }

.detailed-score-table.score-no-raw.score-no-elective .score-freeze-subjects { left: 176px !important; }


.detailed-score-table:not(.score-no-raw) .score-freeze-total {
  left: 306px !important;
}

.detailed-score-table .score-freeze-total {
  border-right: 2px solid #5f6972 !important;
  box-shadow: 3px 0 0 #5f6972 !important;
}

/* Final score-table divider pass: keep column boundaries visible while scrolling. */
.detailed-score-table th,
.detailed-score-table td {
  border-right: 1px solid #8f9aa3 !important;
  border-bottom: 1px solid #8f9aa3 !important;
}

.detailed-score-table th:first-child,
.detailed-score-table td:first-child {
  border-left: 1px solid #8f9aa3 !important;
}

.detailed-score-table .score-freeze {
  background: #fff !important;
  box-shadow: 1px 0 0 #8f9aa3 !important;
}

.detailed-score-table th.score-freeze {
  background: #eef8fb !important;
}

.detailed-score-table .score-freeze-total {
  border-right: 2px solid #6f7a83 !important;
  box-shadow: 2px 0 0 #6f7a83 !important;
}

.quick-record-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.quick-record-main {
  min-width: 0;
  flex: 1 1 auto;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 0;
  cursor: pointer;
}

.quick-record-main:hover strong {
  color: var(--teal);
}

.quick-record-main > div,
.quick-record-item > div {
  min-width: 0;
}

.quick-record-undo {
  flex: 0 0 auto;
  color: #c2410c;
}

/* Memo month events: fixed-height cards with readable text and right-side delete action. */
.memo-month-list .event-row,
.calendar-list .event-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  grid-template-rows: none !important;
  align-items: stretch !important;
  column-gap: 12px !important;
  height: 128px !important;
  min-height: 128px !important;
  max-height: 128px !important;
  overflow: visible !important;
  padding: 12px 12px 12px 14px !important;
}

.memo-month-list .event-main,
.calendar-list .event-main {
  min-width: 0 !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  gap: 8px !important;
  overflow: hidden !important;
}

.memo-month-list .event-main .tag,
.calendar-list .event-main .tag {
  align-self: flex-start !important;
  max-width: 100% !important;
}

.memo-month-list .event-main strong,
.memo-month-list .event-main small,
.calendar-list .event-main strong,
.calendar-list .event-main small {
  display: block !important;
  -webkit-line-clamp: unset !important;
  -webkit-box-orient: initial !important;
  overflow: visible !important;
  white-space: normal !important;
}

.memo-month-list .event-main strong,
.calendar-list .event-main strong {
  line-height: 1.35 !important;
}

.memo-month-list .event-main small,
.calendar-list .event-main small {
  line-height: 1.4 !important;
}

.memo-month-list .event-row .danger,
.calendar-list .event-row .danger {
  align-self: center !important;
  justify-self: end !important;
  min-width: 44px !important;
  padding: 6px 0 !important;
  text-align: center !important;
}

/* Final override 2026-07-09: score table sorting, ruler scrollbar, and no sticky overlap. */
.score-scroll-shell { align-items: center; gap: 8px; }
.score-scroll-top,
.score-scroll-bottom {
  height: 24px;
  border: 1px solid #c6dfe9;
  background: repeating-linear-gradient(90deg, rgba(22, 124, 145, 0.28) 0 1px, transparent 1px 48px), #e6f4f8;
  scrollbar-width: auto;
  scrollbar-color: #157f91 #d5e9f0;
}
.score-scroll-top > div,
.score-scroll-bottom > div { height: 2px; }
.score-scroll-top::-webkit-scrollbar,
.score-scroll-bottom::-webkit-scrollbar,
.score-table-wrap::-webkit-scrollbar { height: 24px; }
.score-scroll-top::-webkit-scrollbar-track,
.score-scroll-bottom::-webkit-scrollbar-track,
.score-table-wrap::-webkit-scrollbar-track {
  background: repeating-linear-gradient(90deg, rgba(22, 124, 145, 0.24) 0 1px, transparent 1px 48px), #dcecf2;
  border-radius: 999px;
}
.score-scroll-top::-webkit-scrollbar-thumb,
.score-scroll-bottom::-webkit-scrollbar-thumb,
.score-table-wrap::-webkit-scrollbar-thumb {
  min-width: 80px;
  background: #147f91;
  border: 1px solid #dcecf2;
  border-radius: 999px;
}
.score-scroll-arrow {
  width: 32px;
  height: 24px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(15, 111, 132, 0.14);
}
.score-scroll-arrow span { width: 12px; height: 2px; }
.score-scroll-arrow-right span::after,
.score-scroll-arrow-left span::before { width: 5px; height: 5px; }
.score-scroll-arrow-right span::after { border-width: 2px 2px 0 0; }
.score-scroll-arrow-left span::before { border-width: 0 0 2px 2px; }
.score-table-wrap:has(.detailed-score-table) {
  overflow-x: auto;
  overflow-y: visible;
}
.detailed-score-table {
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  width: max-content;
  max-width: none;
}
.detailed-score-table .score-col-no { width: 96px; }
.detailed-score-table .score-col-name { width: 92px; }
.detailed-score-table .score-col-subjects { width: 150px; }
.detailed-score-table .score-col-total { width: 178px; }
.detailed-score-table .score-col-rank { width: 142px; }
.detailed-score-table .score-col-subject { width: 182px; }
.detailed-score-table th,
.detailed-score-table td {
  border-right: 1px solid #d9e7ef;
  border-bottom: 1px solid #d9e7ef;
  padding: 7px 8px;
}
.detailed-score-table th:first-child,
.detailed-score-table td:first-child { border-left: 1px solid #d9e7ef; }
.detailed-score-table .score-freeze {
  position: sticky;
  background: #fff;
  z-index: 4;
  box-shadow: 1px 0 0 #cddfe8;
}
.detailed-score-table th.score-freeze {
  z-index: 6;
  background: #eef8fb;
}
.detailed-score-table .score-freeze-no { left: 0; }
.detailed-score-table .score-freeze-name { left: 96px; }
.detailed-score-table .score-freeze-subjects { left: 188px; }
.detailed-score-table .score-freeze-total { left: 338px; }
.detailed-score-table .score-stack { gap: 4px 6px; }
.score-sort-head {
  display: grid;
  justify-items: center;
  gap: 5px;
}
.score-sort-head > strong {
  font-size: 13.5px;
  line-height: 1.2;
}
.score-sort-head > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
}
.score-sort-btn {
  border: 1px solid #bdd6e2;
  border-radius: 999px;
  background: #fff;
  color: #31566a;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 4px 7px;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}
.score-sort-btn span {
  margin-left: 2px;
  font-weight: 800;
}
.score-sort-btn.active,
.score-sort-btn:hover {
  border-color: #168499;
  background: #e6f6f9;
  color: #0c6678;
}
.chat-message-time {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  margin-bottom: 5px;
}

/* Score table final adjustment: compact subjects, stable sort buttons, light ruler scrollbar. */
.score-scroll-shell {
  align-items: center;
  gap: 6px;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.score-scroll-top,
.score-scroll-bottom {
  height: 14px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background:
    repeating-linear-gradient(90deg, rgba(20, 127, 145, 0.32) 0 1px, transparent 1px 42px),
    linear-gradient(180deg, transparent 0 5px, #d9edf3 5px 9px, transparent 9px 100%) !important;
  box-shadow: none !important;
  scrollbar-width: thin;
  scrollbar-color: #147f91 #d9edf3;
}

.score-scroll-top > div,
.score-scroll-bottom > div {
  height: 1px !important;
}

.score-scroll-top::-webkit-scrollbar,
.score-scroll-bottom::-webkit-scrollbar,
.score-table-wrap::-webkit-scrollbar {
  height: 14px !important;
}

.score-scroll-top::-webkit-scrollbar-track,
.score-scroll-bottom::-webkit-scrollbar-track,
.score-table-wrap::-webkit-scrollbar-track {
  background:
    repeating-linear-gradient(90deg, rgba(20, 127, 145, 0.28) 0 1px, transparent 1px 42px),
    #d9edf3 !important;
  border: 0 !important;
  border-radius: 999px;
}

.score-scroll-top::-webkit-scrollbar-thumb,
.score-scroll-bottom::-webkit-scrollbar-thumb,
.score-table-wrap::-webkit-scrollbar-thumb {
  background: #147f91 !important;
  border: 0 !important;
  border-radius: 999px;
  min-width: 64px;
}

.score-scroll-arrow {
  width: 18px !important;
  height: 14px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
}

.score-scroll-arrow:hover {
  background: transparent !important;
  box-shadow: none !important;
  transform: none !important;
}

.score-scroll-arrow span {
  width: 9px !important;
  height: 2px !important;
  background: #0b5f72;
}

.score-scroll-arrow-right span::after,
.score-scroll-arrow-left span::before {
  width: 4px !important;
  height: 4px !important;
  border-color: #0b5f72;
}

.score-scroll-arrow-right span::after {
  border-width: 2px 2px 0 0 !important;
}

.score-scroll-arrow-left span::before {
  border-width: 0 0 2px 2px !important;
}

.detailed-score-table .score-col-no { width: 92px !important; }
.detailed-score-table .score-col-name { width: 92px !important; }
.detailed-score-table .score-col-subjects { width: 104px !important; }
.detailed-score-table .score-col-total { width: 178px !important; }
.detailed-score-table .score-col-rank { width: 142px !important; }
.detailed-score-table .score-col-subject { width: 182px !important; }

.detailed-score-table th,
.detailed-score-table td {
  border-right: 1px solid #d2e3eb !important;
}

.detailed-score-table .score-freeze {
  background-clip: padding-box;
  border-right: 1px solid #bed5df !important;
  box-shadow: 2px 0 0 #d2e3eb !important;
}

.detailed-score-table .score-freeze-no { left: 0 !important; }
.detailed-score-table .score-freeze-name { left: 92px !important; }
.detailed-score-table .score-freeze-subjects { left: 184px !important; }
.detailed-score-table .score-freeze-total { left: 288px !important; }

.detailed-score-table td.score-freeze-subjects {
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.score-sort-head > div {
  display: grid !important;
  grid-template-columns: repeat(2, 46px);
  grid-auto-rows: 24px;
  justify-content: center;
  gap: 4px;
}

.score-sort-btn {
  width: 46px;
  min-width: 46px;
  height: 24px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  line-height: 1;
}

.score-sort-btn span {
  margin-left: 0 !important;
}

/* Memo calendar month list: fixed item height, no proportional stretching. */
.memo-month-list .memo-scroll {
  flex: 1 1 auto;
  align-content: start;
  align-items: start;
  gap: 12px;
  overflow-y: auto;
}

.memo-month-list .event-row {
  display: grid;
  grid-template-rows: 1fr auto;
  height: 136px;
  min-height: 136px;
  max-height: 136px;
  align-self: start;
  overflow: hidden;
}

.memo-month-list .event-main {
  min-height: 0;
  display: grid;
  gap: 8px;
  align-content: start;
}

.memo-month-list .event-main strong,
.memo-month-list .event-main small {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.memo-month-list .event-main strong {
  -webkit-line-clamp: 2;
}

.memo-month-list .event-main small {
  -webkit-line-clamp: 1;
}

.memo-month-list .event-row .danger {
  align-self: end;
  justify-self: center;
}

/* Score compact mode when raw scores and elective ranks are hidden. */
.detailed-score-table.score-no-raw.score-no-elective .score-col-no { width: 88px !important; }
.detailed-score-table.score-no-raw.score-no-elective .score-col-name { width: 88px !important; }


.detailed-score-table.score-no-raw.score-no-elective .score-col-rank { width: 112px !important; }
.detailed-score-table.score-no-raw.score-no-elective .score-col-subject { width: 140px !important; }

.detailed-score-table.score-no-raw.score-no-elective .score-freeze-no { left: 0 !important; }
.detailed-score-table.score-no-raw.score-no-elective .score-freeze-name { left: 88px !important; }
.detailed-score-table.score-no-raw.score-no-elective .score-freeze-subjects { left: 176px !important; }


.detailed-score-table.score-no-raw.score-no-elective th,
.detailed-score-table.score-no-raw.score-no-elective td {
  text-align: center;
  padding-left: 6px;
  padding-right: 6px;
}

.detailed-score-table.score-no-raw.score-no-elective .score-stack {
  justify-content: center;
  justify-items: center;
  align-items: center;
  grid-template-columns: repeat(2, minmax(0, max-content));
}

.detailed-score-table.score-no-raw.score-no-elective .score-freeze-total .score-stack {
  grid-template-columns: minmax(0, max-content);
}

.detailed-score-table.score-no-raw.score-no-elective .score-cell-line,
.detailed-score-table.score-no-raw.score-no-elective .score-field-button {
  justify-content: center;
  text-align: center;
}

.detailed-score-table.score-no-raw.score-no-elective .score-sort-head > div {
  grid-template-columns: repeat(2, 42px);
}

.detailed-score-table.score-no-raw.score-no-elective .score-sort-btn {
  width: 42px;
  min-width: 42px;
}

/* Final score table revision: sortable headers, ruler scrollbars, and calibrated sticky columns. */
.score-scroll-shell {
  align-items: center;
  gap: 8px;
}

.score-scroll-top,
.score-scroll-bottom {
  height: 24px;
  border: 1px solid #c6dfe9;
  background:
    repeating-linear-gradient(90deg, rgba(22, 124, 145, 0.28) 0 1px, transparent 1px 48px),
    #e6f4f8;
  scrollbar-width: auto;
  scrollbar-color: #157f91 #d5e9f0;
}

.score-scroll-top > div,
.score-scroll-bottom > div {
  height: 2px;
}

.score-scroll-top::-webkit-scrollbar,
.score-scroll-bottom::-webkit-scrollbar,
.score-table-wrap::-webkit-scrollbar {
  height: 24px;
}

.score-scroll-top::-webkit-scrollbar-track,
.score-scroll-bottom::-webkit-scrollbar-track,
.score-table-wrap::-webkit-scrollbar-track {
  background:
    repeating-linear-gradient(90deg, rgba(22, 124, 145, 0.24) 0 1px, transparent 1px 48px),
    #dcecf2;
  border-radius: 999px;
}

.score-scroll-top::-webkit-scrollbar-thumb,
.score-scroll-bottom::-webkit-scrollbar-thumb,
.score-table-wrap::-webkit-scrollbar-thumb {
  min-width: 80px;
  background: #147f91;
  border: 1px solid #dcecf2;
  border-radius: 999px;
}

.score-scroll-arrow {
  width: 32px;
  height: 24px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(15, 111, 132, 0.14);
}

.score-scroll-arrow span {
  width: 12px;
  height: 2px;
}

.score-scroll-arrow-right span::after,
.score-scroll-arrow-left span::before {
  width: 5px;
  height: 5px;
}

.score-scroll-arrow-right span::after {
  border-width: 2px 2px 0 0;
}

.score-scroll-arrow-left span::before {
  border-width: 0 0 2px 2px;
}

.score-table-wrap:has(.detailed-score-table) {
  overflow-x: auto;
  overflow-y: visible;
}

.detailed-score-table {
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  width: max-content;
  max-width: none;
}

.detailed-score-table .score-col-no { width: 96px; }
.detailed-score-table .score-col-name { width: 92px; }
.detailed-score-table .score-col-subjects { width: 150px; }
.detailed-score-table .score-col-total { width: 178px; }
.detailed-score-table .score-col-rank { width: 142px; }
.detailed-score-table .score-col-subject { width: 182px; }

.detailed-score-table th,
.detailed-score-table td {
  border-right: 1px solid #d9e7ef;
  border-bottom: 1px solid #d9e7ef;
  padding: 7px 8px;
}

.detailed-score-table th:first-child,
.detailed-score-table td:first-child {
  border-left: 1px solid #d9e7ef;
}

.detailed-score-table .score-freeze {
  position: sticky;
  background: #fff;
  z-index: 4;
  box-shadow: 1px 0 0 #cddfe8;
}

.detailed-score-table th.score-freeze {
  z-index: 6;
  background: #eef8fb;
}

.detailed-score-table .score-freeze-no { left: 0; }
.detailed-score-table .score-freeze-name { left: 96px; }
.detailed-score-table .score-freeze-subjects { left: 188px; }
.detailed-score-table .score-freeze-total { left: 338px; }

.detailed-score-table .score-stack {
  gap: 4px 6px;
}

.score-sort-head {
  display: grid;
  justify-items: center;
  gap: 5px;
}

.score-sort-head > strong {
  font-size: 13.5px;
  line-height: 1.2;
}

.score-sort-head > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
}

.score-sort-btn {
  border: 1px solid #bdd6e2;
  border-radius: 999px;
  background: #fff;
  color: #31566a;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 4px 7px;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.score-sort-btn span {
  margin-left: 2px;
  font-weight: 800;
}

.score-sort-btn.active,
.score-sort-btn:hover {
  border-color: #168499;
  background: #e6f6f9;
  color: #0c6678;
}

.chat-message-time {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  margin-bottom: 5px;
}

.quick-record-layout {
  margin-top: 12px;
}

.calendar-day {
  height: 126px;
  min-height: 126px;
  max-height: 126px;
}

.calendar-chip {
  flex: 0 0 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.memo-main-grid {
  align-items: stretch;
}

.memo-scroll {
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}

.dashboard-main-grid {
  margin-bottom: 22px;
}

.compact-profile-grid {
  grid-template-columns: minmax(0, 1fr);
}

.recent-week-summary {
  margin-top: 12px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 7px;
  min-height: 112px;
  max-height: 170px;
  overflow-y: auto;
}

.student-portrait-text {
  margin-top: 14px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  border-radius: 8px;
  padding: 12px;
  min-height: 132px;
  max-height: 210px;
  overflow-y: auto;
  line-height: 1.7;
  color: var(--text);
}

.settings-derived-class {
  min-height: 66px;
  align-content: center;
}

.admin-stats-grid {
  margin-top: 14px;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
  line-height: 1.55;
}

.admin-table th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  background: var(--panel-soft);
}

.admin-table td:first-child {
  display: grid;
  gap: 6px;
}

.admin-privacy-note {
  margin-top: 14px;
}

.admin-server-panel {
  margin-top: 16px !important;
}

.admin-server-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 12px !important;
}

.admin-server-card {
  min-width: 0 !important;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  background: #f8fcfd !important;
  padding: 12px !important;
  display: grid !important;
  gap: 5px !important;
}

.admin-server-card span,
.admin-server-card small {
  color: var(--muted) !important;
}

.admin-server-card strong {
  color: var(--text) !important;
  font-size: 18px !important;
}

.admin-server-card.warning {
  background: #fff8ed !important;
  border-color: #f3d4a7 !important;
}

.admin-maintenance-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 12px;
  margin-top: 12px;
}

.admin-maintenance-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.admin-maintenance-card.warning {
  background: #fff8ed;
  border-color: #f3d4a7;
}

.admin-maintenance-card h3 {
  margin: 0;
  font-size: 16px;
}

.admin-maintenance-list {
  display: grid;
  gap: 8px;
}

.admin-maintenance-list div {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.admin-maintenance-list span,
.admin-log-list {
  color: var(--muted);
  word-break: break-word;
}

.admin-log-list {
  max-height: 180px;
  overflow: auto;
  display: grid;
  gap: 6px;
  font-size: 12px;
  line-height: 1.5;
}

.admin-log-list div {
  border-bottom: 1px dashed var(--line);
  padding-bottom: 5px;
}

.admin-usage-cell {
  display: grid;
  gap: 3px;
  min-width: 220px;
}

.admin-usage-cell strong {
  color: var(--text);
}

.admin-usage-cell span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 1100px) {
  .admin-server-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .admin-maintenance-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .admin-server-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Final responsive overrides for the detail modal and memo hub. */
.student-detail-backdrop {
  padding: clamp(8px, 1vw, 16px);
  align-items: stretch;
}

.student-detail-backdrop .detail-modal {
  width: min(96vw, 1760px);
  max-width: none;
  max-height: calc(100vh - 16px);
  min-height: min(900px, calc(100vh - 16px));
  padding: clamp(16px, 1.4vw, 24px);
}

.detail-modal .behavior-layout {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  align-items: start;
}

.detail-modal .behavior-day-grid {
  grid-auto-rows: 76px;
  align-content: start;
  gap: 8px;
}

.detail-modal .behavior-day,
.detail-modal .calendar-empty {
  height: 76px;
  min-height: 76px;
  max-height: 76px;
}

@media (min-width: 1440px) {
  .student-detail-backdrop .detail-modal {
    width: min(97vw, 1840px);
  }

  .detail-modal .behavior-day-grid {
    grid-auto-rows: 82px;
  }

  .detail-modal .behavior-day,
  .detail-modal .calendar-empty {
    height: 82px;
    min-height: 82px;
    max-height: 82px;
  }
}

@media (max-width: 720px) {
  .student-detail-backdrop .detail-modal {
    width: calc(100vw - 16px);
    min-height: auto;
    max-height: calc(100vh - 16px);
  }

  .detail-modal .behavior-day-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 66px;
  }

  .detail-modal .behavior-day,
  .detail-modal .calendar-empty {
    height: 66px;
    min-height: 66px;
    max-height: 66px;
  }
}

/* Score table readability pass: final overrides for stronger scroll controls and two-by-two metrics. */
.student-table th {
  text-align: center;
  vertical-align: middle;
}

.score-scroll-shell {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 46px;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}

.score-scroll-shell-bottom {
  margin-top: 10px;
}

.score-scroll-top,
.score-scroll-bottom {
  height: 34px;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid #c7dde7;
  border-radius: 999px;
  background: #f2f8fb;
  scrollbar-width: auto;
  scrollbar-color: #167c91 #dcecf2;
}

.score-scroll-top::before {
  content: none !important;
}

.score-scroll-top > div,
.score-scroll-bottom > div {
  height: 1px;
}

.score-scroll-top::-webkit-scrollbar,
.score-scroll-bottom::-webkit-scrollbar,
.score-table-wrap::-webkit-scrollbar {
  height: 18px;
}

.score-scroll-top::-webkit-scrollbar-track,
.score-scroll-bottom::-webkit-scrollbar-track,
.score-table-wrap::-webkit-scrollbar-track {
  background: #dcecf2;
  border-radius: 999px;
}

.score-scroll-top::-webkit-scrollbar-thumb,
.score-scroll-bottom::-webkit-scrollbar-thumb,
.score-table-wrap::-webkit-scrollbar-thumb {
  min-width: 72px;
  background: linear-gradient(90deg, #14869a, #0f6f84);
  border: 3px solid #dcecf2;
  border-radius: 999px;
}

.score-scroll-arrow {
  width: 46px;
  height: 34px;
  border: 1px solid #0f7f94;
  border-radius: 10px;
  background: linear-gradient(180deg, #f5fcff, #dff2f7);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(15, 111, 132, 0.16);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.score-scroll-arrow:hover {
  background: linear-gradient(180deg, #ffffff, #ccebf2);
  box-shadow: 0 5px 14px rgba(15, 111, 132, 0.24);
  transform: translateY(-1px);
}

.score-scroll-arrow span {
  position: relative;
  display: block;
  width: 25px;
  height: 3px;
  border-radius: 999px;
  background: #0b5f72;
}

.score-scroll-arrow-right span::after,
.score-scroll-arrow-left span::before {
  content: "";
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  border-color: #0b5f72;
  border-style: solid;
}

.score-scroll-arrow-right span::after {
  right: -1px;
  border-width: 3px 3px 0 0;
  transform: translateY(-50%) rotate(45deg);
}

.score-scroll-arrow-left span::before {
  left: -1px;
  border-width: 0 0 3px 3px;
  transform: translateY(-50%) rotate(45deg);
}

.score-table-wrap:has(.detailed-score-table) {
  overflow-x: auto;
}

.detailed-score-table {
  width: max-content;
  max-width: none;
  table-layout: fixed;
  font-size: 14px;
}

.detailed-score-table .score-col-total {
  width: 180px;
}

.detailed-score-table .score-col-rank {
  width: 148px;
}

.detailed-score-table .score-col-subject {
  width: 190px;
}

.detailed-score-table th,
.detailed-score-table td {
  font-size: 14px;
  line-height: 1.45;
  white-space: nowrap;
  overflow: visible;
  word-break: normal;
  overflow-wrap: normal;
  padding: 8px 10px;
  vertical-align: middle;
}

.detailed-score-table th {
  font-size: 14.5px;
  text-align: center;
}

.detailed-score-table .score-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 8px;
  align-items: center;
  width: 100%;
}

.detailed-score-table .score-stack > *:not(:last-child)::after {
  content: none;
}

.detailed-score-table .score-cell-line {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  min-width: 0;
  color: #365365;
  font-size: 13.5px;
  white-space: nowrap;
}

.detailed-score-table .score-cell-line b {
  flex: 0 0 auto;
  min-width: 2.1em;
  color: #516b7a;
  font-weight: 700;
}

.detailed-score-table .score-field-button {
  justify-content: center;
  gap: 3px;
  font-size: 13.5px;
  white-space: nowrap;
  flex-wrap: nowrap;
}

.detailed-score-table .score-field-button strong {
  font-size: 14.5px;
}

.detailed-score-table .score-trend {
  font-size: 12.5px;
}

.quick-review-modal {
  max-width: 640px;
}

.quick-review-card {
  border: 1px solid #d4e5ef;
  background: #f6fbfd;
  border-radius: 10px;
  padding: 14px 16px;
  margin: 12px 0 16px;
}

.quick-review-card strong {
  display: block;
  color: #0f5f73;
  font-size: 18px;
  margin: 4px 0 8px;
}

.quick-review-route-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.quick-review-type-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.quick-review-type-select {
  min-width: 168px;
  height: 42px;
  min-height: 42px;
  padding: 0 34px 0 12px;
  line-height: 40px;
  vertical-align: middle;
}

.quick-review-card p {
  margin: 0;
  color: #31475a;
  line-height: 1.6;
}

.quick-review-modal textarea {
  min-height: 180px;
}

.quick-correct-row {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.quick-pin-row {
  grid-column: 1 / -1;
  justify-self: start;
  padding: 0;
  border: 0;
  background: transparent;
  gap: 6px;
}

.quick-pin-row input {
  width: auto;
  margin: 0;
}

.danger-zone {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #facc15;
  background: #fffbeb;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.danger-confirm-modal {
  position: relative;
}

.danger-confirm-icon {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: #facc15;
  color: #713f12;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 24px;
  margin-bottom: 10px;
}

.danger-warning {
  background: #fffbeb;
  border-color: #facc15;
  color: #713f12;
}

.reversed-actions {
  justify-content: flex-start;
}

/* Final polish: wide score table, stable calendar cells, lightweight motion. */
.sidebar-user {
  margin: 12px 0 16px;
  padding: 11px 12px;
  border: 1px solid rgba(216, 228, 236, 0.78);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  display: grid;
  gap: 4px;
  min-width: 0;
}

.sidebar-user strong {
  color: var(--text);
  font-size: 14px;
}

.sidebar-user span {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-scroll-top {
  overflow-x: auto;
  overflow-y: hidden;
  height: 15px;
  margin: 0 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.score-scroll-top > div {
  height: 1px;
}

.score-table-wrap:has(.detailed-score-table) {
  overflow-x: auto;
  overflow-y: visible;
}

.detailed-score-table {
  width: max-content;
  max-width: none;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
}

.detailed-score-table th,
.detailed-score-table td {
  padding: 6px 10px;
  min-width: 128px;
  width: auto;
  max-width: none;
  white-space: nowrap;
  overflow: visible;
  overflow-wrap: normal;
  word-break: normal;
  text-align: center;
  vertical-align: middle;
  font-size: 12px;
  line-height: 1.34;
  background: #fff;
}

.detailed-score-table th {
  position: sticky;
  top: 0;
  z-index: 6;
  background: #f8fcff;
}

.detailed-score-table th:nth-child(1),
.detailed-score-table td:nth-child(1) {
  min-width: 92px;
  width: 92px;
  position: sticky;
  left: 0;
  z-index: 5;
}

.detailed-score-table th:nth-child(2),
.detailed-score-table td:nth-child(2) {
  min-width: 88px;
  width: 88px;
  position: sticky;
  left: 92px;
  z-index: 5;
}

.detailed-score-table th:nth-child(3),
.detailed-score-table td:nth-child(3) {
  min-width: 118px;
  width: 118px;
  position: sticky;
  left: 180px;
  z-index: 5;
}

.detailed-score-table th:nth-child(4),
.detailed-score-table td:nth-child(4) {
  min-width: 142px;
  width: 142px;
  position: sticky;
  left: 298px;
  z-index: 5;
  box-shadow: 8px 0 14px rgba(31, 42, 55, 0.06);
}

.detailed-score-table th:nth-child(-n+4) {
  z-index: 8;
  background: #f1f8fb;
}

.detailed-score-table td:nth-child(-n+4) {
  background: #fff;
}

.detailed-score-table .score-stack {
  display: grid;
  justify-items: center;
  gap: 3px;
  width: 100%;
}

.detailed-score-table .score-stack > * {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  line-height: 1.25;
}

.detailed-score-table .score-stack > *::after {
  content: none !important;
}

.detailed-score-table .score-field-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  line-height: 1.25;
}

.detailed-score-table .text-btn {
  white-space: nowrap;
}

.memo-calendar-panel .calendar-grid {
  grid-auto-rows: 132px;
  align-items: stretch;
}

.memo-calendar-panel .calendar-empty,
.memo-calendar-panel .calendar-day,
.memo-calendar-panel .compact-calendar .calendar-day {
  height: 132px;
  min-height: 132px;
  max-height: 132px;
}

.memo-calendar-panel .calendar-day {
  align-content: start;
  gap: 6px;
}

.memo-calendar-panel .calendar-chip {
  flex: 0 0 24px;
  height: 24px;
  line-height: 14px;
  padding: 5px 6px;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-record-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.quick-record-head h3 {
  margin: 0;
}

button,
a,
select,
input,
textarea,
.panel,
.nav a,
.student-card,
.todo-item,
.comm-item,
.memo-list-item,
.quick-record-item,
.calendar-day,
.calendar-chip,
.score-field-button,
.modal,
.tag {
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 180ms ease, transform 160ms ease, opacity 160ms ease;
}

.primary-btn:hover,
.ghost-btn:hover,
.text-btn:hover,
.nav a:hover,
.memo-list-item:hover,
.quick-record-item:hover,
.calendar-day:hover,
.score-field-button:hover {
  transform: translateY(-1px);
}

.modal-backdrop {
  animation: softFadeIn 140ms ease;
}

.modal {
  animation: softRiseIn 170ms ease;
}

@keyframes softFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes softRiseIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Final dashboard, score-scroll, and admin-management overrides. */
.accent-cyan {
  border-left: 4px solid var(--cyan);
}

.score-scroll-top {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 24px;
  padding: 3px;
  margin: 0 0 10px;
  border: 1px solid #8fb6c4;
  border-radius: 8px;
  background: linear-gradient(180deg, #eefbff, #dceff5);
  box-shadow: 0 6px 14px rgba(31, 42, 55, 0.12);
}

.score-scroll-top::before {
  content: "左右滑动查看成绩字段";
  position: sticky;
  left: 10px;
  top: 0;
  z-index: 1;
  display: inline-block;
  color: var(--primary-dark);
  font-size: 12px;
  line-height: 16px;
  pointer-events: none;
}

.score-scroll-top::-webkit-scrollbar,
.score-table-wrap::-webkit-scrollbar {
  height: 14px;
}

.score-scroll-top::-webkit-scrollbar-track,
.score-table-wrap::-webkit-scrollbar-track {
  background: #e3eef4;
  border-radius: 999px;
}

.score-scroll-top::-webkit-scrollbar-thumb,
.score-table-wrap::-webkit-scrollbar-thumb {
  background: #6f97a8;
  border: 3px solid #e3eef4;
  border-radius: 999px;
}

.dashboard-watch-section {
  display: grid;
  gap: 16px;
  margin-bottom: 22px;
}

.dashboard-watch-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  color: var(--muted);
  font-size: 13px;
}

.dashboard-watch-controls label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.dashboard-watch-controls input {
  width: 58px;
  padding: 5px 6px;
}

.dashboard-item-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.dashboard-card-item {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 10px;
  text-align: left;
  color: var(--text);
  cursor: pointer;
}

.dashboard-card-item:hover {
  border-color: var(--primary);
  background: #f2fbfd;
}

.admin-table {
  min-width: 1280px;
}

.admin-table th,
.admin-table td {
  vertical-align: top;
}

.admin-email-cell {
  display: grid;
  gap: 6px;
  align-content: start;
  word-break: break-word;
}

.admin-email-cell strong {
  line-height: 1.45;
}

.admin-compact-select {
  min-width: 92px;
  padding: 6px 8px;
}

.admin-table-wrap {
  overflow: visible !important;
}

.admin-table {
  min-width: 0 !important;
  table-layout: fixed;
  font-size: 13px;
}

.admin-table th,
.admin-table td {
  padding: 9px 8px;
  word-break: break-word;
}

.admin-table th:nth-child(1),
.admin-table td:nth-child(1) {
  width: 19%;
}

.admin-table th:nth-child(6),
.admin-table td:nth-child(6) {
  width: 20%;
}

.admin-table th:nth-child(9),
.admin-table td:nth-child(9) {
  width: 7%;
}

.score-zone-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}

.score-zone-title h3 {
  margin: 0;
  font-size: 18px;
}

.score-zone-title span {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1280px) {
  .dashboard-item-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .dashboard-item-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-watch-controls {
    justify-content: stretch;
  }

  .dashboard-watch-controls label {
    width: 100%;
    justify-content: space-between;
  }
}

/* Final score-table correction: explicit columns, no sticky gaps. */
.sidebar-user {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.sidebar-user strong {
  color: #f8fcff;
}

.dashboard-stats-grid {
  grid-template-columns: 1fr 1.35fr 1fr 1fr;
}

.dashboard-summary-card {
  appearance: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.dashboard-combined-watch-card {
  display: grid;
  gap: 12px;
}

.dashboard-watch-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.dashboard-watch-summary button {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.dashboard-watch-summary button:hover {
  border-color: rgba(30, 136, 168, 0.45);
  background: #fff;
  transform: translateY(-1px);
}

.dashboard-watch-summary strong {
  font-size: 26px;
  line-height: 1;
}

.dashboard-watch-summary span {
  font-weight: 700;
}

.dashboard-watch-summary small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.dashboard-scroll-target {
  scroll-margin: 32vh;
}

.dashboard-panel-flash {
  animation: dashboardPanelFlash 0.78s ease-in-out 2;
}

@keyframes dashboardPanelFlash {
  0% {
    border-color: var(--line);
    box-shadow: 0 4px 14px rgba(31, 42, 55, 0.04);
  }
  45% {
    border-color: rgba(30, 136, 168, 0.75);
    box-shadow: 0 0 0 4px rgba(30, 136, 168, 0.12), 0 14px 28px rgba(31, 42, 55, 0.12);
  }
  100% {
    border-color: var(--line);
    box-shadow: 0 4px 14px rgba(31, 42, 55, 0.04);
  }
}

@media (max-width: 1280px) {
  .dashboard-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .dashboard-stats-grid,
  .dashboard-watch-summary {
    grid-template-columns: 1fr;
  }
}

/* Current polish: fixed calendar-list cards, refined score scrollbars, and stronger dashboard focus flash. */
.calendar-list {
  align-content: start;
  align-items: start;
}

.calendar-list .event-row {
  min-height: 118px;
  max-height: 146px;
  align-self: start;
  overflow: hidden;
}

.calendar-list .event-main {
  min-height: 0;
}

.calendar-list .event-row strong,
.calendar-list .event-row small {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.calendar-list .event-row strong {
  -webkit-line-clamp: 2;
}

.calendar-list .event-row small {
  -webkit-line-clamp: 1;
}

.calendar-list .event-row .danger {
  align-self: end;
  justify-self: end;
}

.score-scroll-hint {
  margin: 6px 2px 6px;
  color: #5f7280;
  font-size: 12px;
  line-height: 1.4;
}

.score-scroll-hint::before {
  content: "提示：";
  color: var(--primary-dark);
  font-weight: 700;
}

.score-scroll-hint-bottom {
  margin-top: 7px;
  text-align: right;
}

.score-scroll-top {
  height: 18px;
  padding: 4px 5px;
  margin: 0 0 8px;
  border: 1px solid #d5e4eb;
  border-radius: 999px;
  background: #f7fbfd;
  box-shadow: inset 0 1px 2px rgba(31, 42, 55, 0.06), 0 1px 2px rgba(31, 42, 55, 0.03);
  scrollbar-color: #8fb0bf #eaf2f6;
  scrollbar-width: thin;
}

.score-scroll-top::before {
  content: none;
}

.score-scroll-top > div {
  height: 1px;
}

.score-table-wrap {
  scrollbar-color: #8fb0bf #eaf2f6;
  scrollbar-width: thin;
}

.score-scroll-top::-webkit-scrollbar,
.score-table-wrap::-webkit-scrollbar {
  height: 11px;
}

.score-scroll-top::-webkit-scrollbar-track,
.score-table-wrap::-webkit-scrollbar-track {
  background: #eaf2f6;
  border-radius: 999px;
}

.score-scroll-top::-webkit-scrollbar-thumb,
.score-table-wrap::-webkit-scrollbar-thumb {
  min-width: 48px;
  background: linear-gradient(90deg, #9ab9c6, #719baa);
  border: 2px solid #eaf2f6;
  border-radius: 999px;
}

.score-scroll-top::-webkit-scrollbar-thumb:hover,
.score-table-wrap::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(90deg, #7ea9b8, #4f8799);
}

.dashboard-panel-flash {
  animation: dashboardPanelFlash 0.78s ease-in-out 2;
}

@keyframes dashboardPanelFlash {
  0% {
    background-color: var(--panel);
    border-color: var(--line);
    box-shadow: 0 4px 14px rgba(31, 42, 55, 0.04);
  }
  45% {
    background-color: #e8f7fb;
    border-color: #42a5bd;
    box-shadow: 0 0 0 5px rgba(30, 136, 168, 0.16), 0 18px 34px rgba(31, 42, 55, 0.14);
  }
  100% {
    background-color: var(--panel);
    border-color: var(--line);
    box-shadow: 0 4px 14px rgba(31, 42, 55, 0.04);
  }
}

.sidebar-user span {
  color: #c7dbe3;
}

.detailed-score-table {
  table-layout: fixed;
  width: max-content;
  border-collapse: separate;
  border-spacing: 0;
}

.detailed-score-table .score-col-no {
  width: 88px;
}

.detailed-score-table .score-col-name {
  width: 82px;
}

.detailed-score-table .score-col-subjects {
  width: 118px;
}

.detailed-score-table .score-col-total {
  width: 164px;
}

.detailed-score-table .score-col-rank {
  width: 132px;
}

.detailed-score-table .score-col-subject {
  width: 172px;
}

.detailed-score-table th,
.detailed-score-table td {
  min-width: 0;
  width: auto;
  padding: 7px 10px;
  white-space: nowrap;
}

.detailed-score-table .score-freeze {
  position: sticky;
  z-index: 7;
  background: #fff;
}

.detailed-score-table th.score-freeze {
  z-index: 10;
  background: #eef8fb;
}

.detailed-score-table .score-freeze-no {
  left: 0 !important;
}

.detailed-score-table .score-freeze-name {
  left: 88px !important;
}

.detailed-score-table .score-freeze-subjects {
  left: 170px !important;
}

.detailed-score-table .score-freeze-total {
  left: 288px !important;
  box-shadow: 8px 0 12px rgba(31, 42, 55, 0.06);
}

.detailed-score-table th.score-freeze-no,
.detailed-score-table td.score-freeze-no {
  width: 88px !important;
  min-width: 88px !important;
  max-width: 88px !important;
}

.detailed-score-table th.score-freeze-name,
.detailed-score-table td.score-freeze-name {
  width: 82px !important;
  min-width: 82px !important;
  max-width: 82px !important;
}

.detailed-score-table th.score-freeze-subjects,
.detailed-score-table td.score-freeze-subjects {
  width: 118px !important;
  min-width: 118px !important;
  max-width: 118px !important;
}

.detailed-score-table th.score-freeze-total,
.detailed-score-table td.score-freeze-total {
  width: 164px !important;
  min-width: 164px !important;
  max-width: 164px !important;
}

.score-student-link {
  border: 0;
  background: transparent;
  color: var(--primary-dark);
  font-weight: 800;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
}

.score-student-link:hover {
  background: #e7f5f8;
  color: var(--primary);
}

.detail-score-selectors {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.detail-score-selectors label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.detail-score-selectors select {
  min-width: 220px;
}

.readonly-score-metric {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.readonly-score-metric b {
  color: var(--muted);
  font-weight: 600;
}

.readonly-score-metric strong {
  color: var(--text);
}

.score-detail-item {
  align-items: center;
}

/* Wide-screen density pass: use the available 16:9 workspace more fully. */
.content {
  max-width: none;
  padding: clamp(16px, 1.5vw, 30px);
}

.section {
  margin-bottom: clamp(16px, 1.25vw, 24px);
}

.grid.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.calendar-layout {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 340px);
  align-items: stretch;
}

.calendar-panel {
  padding: clamp(12px, 1vw, 18px);
}

.calendar-week,
.calendar-grid {
  gap: clamp(8px, 0.75vw, 12px);
}

.calendar-day,
.calendar-empty {
  height: clamp(132px, 13vh, 172px);
  min-height: clamp(132px, 13vh, 172px);
  max-height: clamp(132px, 13vh, 172px);
}

.calendar-day {
  padding: 10px;
}

.calendar-chip {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.memo-pin-control {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
}

.memo-pin-control:has(input:checked) {
  border-color: transparent;
  background: transparent;
  color: var(--text);
}

.memo-pin-control input {
  width: auto;
  margin: 0;
}

@media (min-width: 1440px) {
  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .content {
    padding-inline: clamp(24px, 2vw, 42px);
  }

  .calendar-layout {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 360px);
  }
}

@media (max-width: 980px) {
  .grid.two-col,
  .calendar-layout {
    grid-template-columns: 1fr;
  }
}

/* Compact dashboard entry row: keep logs and recent entries inside a short, scrollable workspace. */
.dashboard-quick-section .quick-record-layout {
  min-height: 293px !important;
}

.dashboard-quick-section .quick-record-form {
  height: 293px !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
}

.dashboard-quick-section .quick-record-input {
  height: 293px !important;
  min-height: 293px !important;
  max-height: 293px !important;
  resize: none !important;
}

.dashboard-quick-section .quick-record-panel {
  height: 293px !important;
  max-height: 293px !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

.dashboard-quick-section .quick-record-scroll {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow-y: auto !important;
}

.work-log-scroll {
  max-height: 293px !important;
  overflow-y: auto !important;
}

/* Current layout polish: denser score table, wider calendars, and stable AI shortcuts. */
.memo-top-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 16px;
  align-items: stretch;
}

.memo-top-layout .memo-workspace {
  min-width: 0;
}

.memo-todo-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.memo-todo-panel .memo-scroll {
  max-height: 250px;
}

.memo-done-head {
  margin-top: 18px;
}

.memo-calendar-section .memo-calendar-panel {
  width: 100%;
}

.memo-calendar-layout {
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
}

.memo-week-grid {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  overflow-x: visible;
}

.memo-day-column {
  min-width: 0;
}

.calendar-layout {
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
}

.score-table-wrap:has(.detailed-score-table) {
  overflow-x: hidden;
}

.detailed-score-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.detailed-score-table th,
.detailed-score-table td {
  padding: 5px 4px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: clamp(9px, 0.58vw, 11px);
  line-height: 1.25;
}

.detailed-score-table th:nth-child(1),
.detailed-score-table td:nth-child(1) {
  width: 4.8em;
}

.detailed-score-table th:nth-child(2),
.detailed-score-table td:nth-child(2) {
  width: 4.1em;
}

.detailed-score-table th:nth-child(3),
.detailed-score-table td:nth-child(3) {
  width: 5em;
}

.detailed-score-table th:last-child,
.detailed-score-table td:last-child {
  width: 3.2em;
}

.detailed-score-table .score-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 1px 3px;
}

.detailed-score-table .score-stack > * {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  min-width: 0;
}

.detailed-score-table .score-stack > *:not(:last-child)::after {
  content: "|";
  color: var(--line-strong);
  margin-left: 3px;
  font-weight: 400;
}

.detailed-score-table .score-field-button {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 1px;
  white-space: normal;
  line-height: 1.2;
}

.detailed-score-table .text-btn {
  white-space: normal;
  padding: 0;
}

.chat-panel {
  height: min(960px, calc(100vh - 72px));
  grid-template-rows: minmax(560px, 1fr) auto;
}

.chat-stream-fixed {
  min-height: 680px;
  height: auto;
}

.quick-panel {
  min-width: 0;
}

.quick-panel .list {
  gap: 8px;
}

.quick-chat {
  width: 100%;
  min-width: 0;
  height: auto;
  min-height: 42px;
  padding: 8px 10px;
  white-space: normal !important;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
  text-align: center;
}

.quick-panel .ghost-btn {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 1180px) {
  .memo-top-layout,
  .memo-calendar-layout,
  .calendar-layout {
    grid-template-columns: 1fr;
  }
}

/* Final score-table containment: centered, compact, and no overlap. */
.score-overview,
.score-controls,
.score-table-wrap {
  max-width: 100%;
  box-sizing: border-box;
}

.score-table-wrap:has(.detailed-score-table) {
  overflow: hidden;
}

.detailed-score-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.detailed-score-table th,
.detailed-score-table td {
  box-sizing: border-box;
  padding: 4px 3px;
  text-align: center;
  vertical-align: middle;
  white-space: normal;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: clamp(8.5px, 0.52vw, 10.5px);
  line-height: 1.18;
}

.detailed-score-table th:nth-child(1),
.detailed-score-table td:nth-child(1) {
  width: 4.3em;
}

.detailed-score-table th:nth-child(2),
.detailed-score-table td:nth-child(2) {
  width: 3.7em;
}

.detailed-score-table th:nth-child(3),
.detailed-score-table td:nth-child(3) {
  width: 4.7em;
}

.detailed-score-table th:nth-child(4),
.detailed-score-table td:nth-child(4) {
  width: 5.3em;
}

.detailed-score-table th:nth-child(5),
.detailed-score-table td:nth-child(5),
.detailed-score-table th:nth-child(6),
.detailed-score-table td:nth-child(6) {
  width: 4.4em;
}

.detailed-score-table th:last-child,
.detailed-score-table td:last-child {
  width: 3em;
}

.detailed-score-table .score-stack {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0 2px;
  width: 100%;
}

.detailed-score-table .score-stack > * {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 1px;
  margin: 0;
  min-width: 0;
  color: inherit;
  line-height: 1.18;
}

.detailed-score-table .score-stack > *:not(:last-child)::after {
  content: "|";
  color: var(--line-strong);
  margin-left: 2px;
}

.detailed-score-table .score-cell-line b {
  color: var(--muted);
  font-weight: 500;
}

.detailed-score-table .score-field-button {
  justify-content: center;
  text-align: center;
  line-height: 1.18;
}

.score-student-name {
  text-align: center;
}

/* Detailed score table: prefer fitting the full table over horizontal scrolling. */
.score-table-wrap:has(.detailed-score-table) {
  overflow-x: visible;
}

.detailed-score-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.detailed-score-table th,
.detailed-score-table td {
  padding: 7px 6px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: clamp(10px, 0.68vw, 12px);
  line-height: 1.35;
}

.detailed-score-table th:nth-child(1),
.detailed-score-table td:nth-child(1) {
  width: 5.4em;
}

.detailed-score-table th:nth-child(2),
.detailed-score-table td:nth-child(2) {
  width: 4.6em;
}

.detailed-score-table th:nth-child(3),
.detailed-score-table td:nth-child(3) {
  width: 5.4em;
}

.detailed-score-table th:last-child,
.detailed-score-table td:last-child {
  width: 3.8em;
}

.score-student-name {
  display: block;
  font-size: inherit;
  line-height: 1.35;
}

.detailed-score-table .score-stack {
  gap: 2px;
}

.detailed-score-table .score-stack small,
.detailed-score-table .score-cell-line {
  gap: 2px;
  align-items: flex-start;
  font-size: inherit;
}

.detailed-score-table .score-field-button {
  gap: 2px;
  flex-wrap: wrap;
}

.detailed-score-table .score-trend {
  font-size: inherit;
}

/* Requirement overrides for fixed navigation, quick records, scores, memos, and calendar density. */
.app-shell {
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.quick-record-layout {
  align-items: stretch;
}

.quick-record-form {
  align-items: stretch;
}

.quick-record-input {
  min-height: 220px;
  line-height: 1.55;
  resize: vertical;
}

.quick-record-panel {
  min-height: 300px;
  display: flex;
  flex-direction: column;
}

.quick-record-scroll {
  max-height: 320px;
  flex: 1;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: auto;
  min-width: 0;
}

.checkbox-row input {
  flex: 0 0 auto;
}

.memo-list-item.pinned {
  border-left: 4px solid #f59e0b;
  background: #fff7e6;
}

.memo-list-item.pinned em {
  display: inline-flex;
  align-items: center;
  margin-right: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #f59e0b;
  color: #fff;
  font-size: 12px;
  font-style: normal;
}

.calendar-layout,
.memo-calendar-layout {
  align-items: stretch;
}

.calendar-layout > aside,
.memo-month-list {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.calendar-list,
.memo-month-list .memo-scroll {
  flex: 1;
  max-height: none;
  overflow-y: auto;
}

.memo-week-grid {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.memo-week-grid .memo-week-day {
  min-width: 0;
}

.memo-day-events {
  max-height: none;
  overflow: visible;
}

.score-import-panel,
.score-controls {
  margin-bottom: 16px;
}

.score-toggle-row,
.score-band-row,
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.score-toggle-row,
.score-band-row {
  align-items: center;
  margin-top: 12px;
}

.score-controls .checkbox-row {
  display: inline-flex;
  width: auto;
  min-width: max-content;
  gap: 6px;
  white-space: nowrap;
}

.score-controls .checkbox-row input {
  width: auto;
  margin: 0;
}

.score-exam-actions {
  margin-top: 10px;
}

.score-line-input {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.score-band-row input {
  width: 96px;
}

.score-line-input input {
  width: 96px;
}

.detailed-score-table th,
.detailed-score-table td {
  vertical-align: top;
}

.score-stack {
  display: grid;
  gap: 5px;
}

.score-stack small,
.score-cell-line {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
}

.score-field-button {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  text-align: left;
}

.score-field-button:hover strong {
  color: var(--primary);
  text-decoration: underline;
}

.score-trend {
  font-size: 12px;
  font-weight: 700;
}

.score-trend.up {
  color: #15803d;
}

.score-trend.down {
  color: #dc2626;
}

.score-detail-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.score-detail-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 90px repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
}

.communication-record {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

@media (max-width: 980px) {
  .sidebar {
    position: static;
    height: auto;
  }

  .quick-record-form {
    flex-direction: column;
  }

  .score-detail-item {
    grid-template-columns: 1fr;
  }
}

/* Memo hub: phone-like notes editor plus calendar/todo workspace. */
.memo-workspace {
  display: grid;
  grid-template-columns: minmax(260px, 0.36fr) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.memo-list-panel,
.memo-editor-panel {
  min-height: 520px;
}

.memo-note-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 470px;
  overflow-y: auto;
  padding-right: 4px;
}

.memo-list-item {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  text-align: left;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.memo-list-main {
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  display: grid;
  gap: 6px;
  text-align: left;
  cursor: pointer;
}

.memo-list-item span {
  font-weight: 700;
}

.memo-list-item small {
  color: var(--muted);
  line-height: 1.45;
}

.memo-list-item:hover,
.memo-list-item.active {
  border-color: var(--primary);
  background: #f1fbfd;
}

.memo-editor-form {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.memo-editor-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.memo-pin-control {
  white-space: nowrap;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 14px;
}

.memo-pin-control:has(input:checked) {
  border-color: #f59e0b;
  background: #fff7e6;
  color: #92400e;
}

.memo-auto-save-status {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.memo-auto-save-status[data-state="saving"],
.memo-auto-save-status[data-state="typing"] {
  color: var(--primary);
}

.memo-auto-save-status[data-state="error"] {
  color: var(--red);
}

.memo-editor-time,
.import-result-time {
  margin: 8px 0 10px;
  font-size: 13px;
}

.memo-title-input {
  border: none;
  border-bottom: 1px solid var(--line);
  padding: 10px 2px 12px;
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  outline: none;
}

.memo-content-input {
  flex: 1;
  min-height: 380px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  resize: vertical;
  line-height: 1.7;
  color: var(--text);
  background: #fff;
}

.memo-empty-editor {
  min-height: 420px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: var(--muted);
  text-align: center;
}

.memo-empty-editor h3 {
  color: var(--text);
  margin: 0;
}

.memo-support-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.55fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.memo-side-stack {
  display: grid;
  gap: 16px;
}

.memo-calendar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.segmented-btn {
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  padding: 9px 14px;
  cursor: pointer;
}

.segmented-btn:last-child {
  border-right: 0;
}

.segmented-btn.active {
  background: var(--primary);
  color: #fff;
}

.memo-calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.38fr);
  gap: 14px;
  align-items: start;
}

.compact-calendar .calendar-day {
  height: 112px;
  min-height: 112px;
  max-height: 112px;
}

.memo-month-list h3 {
  margin: 0 0 12px;
}

.memo-week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(150px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.memo-day-column {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  min-height: 260px;
  padding: 10px;
}

.memo-day-head {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  padding: 0 0 10px;
  display: flex;
  justify-content: space-between;
  cursor: pointer;
}

.memo-day-head span {
  color: var(--primary);
}

.memo-day-events {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.memo-day-focus {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 14px;
}

.memo-scroll.compact {
  max-height: 260px;
}

.student-detail-backdrop {
  padding: clamp(8px, 1vw, 16px);
  align-items: stretch;
}

.student-detail-backdrop .detail-modal {
  width: min(96vw, 1760px);
  max-width: none;
  max-height: calc(100vh - 16px);
  min-height: min(900px, calc(100vh - 16px));
  padding: clamp(16px, 1.4vw, 24px);
}

.detail-modal .behavior-layout {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  align-items: start;
}

.detail-modal .behavior-day-grid {
  grid-auto-rows: 76px;
  align-content: start;
  gap: 8px;
}

.detail-modal .behavior-day {
  height: 76px;
  min-height: 76px;
  max-height: 76px;
}

.detail-modal .calendar-empty {
  min-height: 76px;
}

@media (min-width: 1440px) {
  .student-detail-backdrop .detail-modal {
    width: min(97vw, 1840px);
  }

  .detail-modal .behavior-day-grid {
    grid-auto-rows: 82px;
  }

  .detail-modal .behavior-day,
  .detail-modal .calendar-empty {
    height: 82px;
    min-height: 82px;
    max-height: 82px;
  }
}

@media (max-width: 1100px) {
  .memo-workspace,
  .memo-support-grid,
  .memo-calendar-layout {
    grid-template-columns: 1fr;
  }

  .memo-list-panel,
  .memo-editor-panel {
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .memo-editor-toolbar,
  .memo-calendar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .memo-title-input {
    font-size: 20px;
  }

  .memo-content-input {
    min-height: 300px;
  }

  .student-detail-backdrop .detail-modal {
    width: calc(100vw - 16px);
    min-height: auto;
    max-height: calc(100vh - 16px);
  }

  .detail-modal .behavior-day-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 66px;
  }

  .detail-modal .behavior-day,
  .detail-modal .calendar-empty {
    height: 66px;
    min-height: 66px;
    max-height: 66px;
  }
}

.student-detail-backdrop {
  padding: 12px;
  align-items: flex-start;
}

.detail-modal {
  width: min(1500px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  padding: 20px;
}

.detail-modal .detail-bottom-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
}

.detail-modal .detail-head {
  padding: 16px;
  margin-bottom: 14px;
}

.detail-modal .panel {
  padding: 16px;
}

@media (min-width: 1280px) {
  .detail-modal {
    width: min(1560px, calc(100vw - 28px));
  }
}

@media (max-width: 980px) {
  .student-detail-backdrop {
    padding: 10px;
  }

  .detail-modal {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    padding: 16px;
  }
}

.behavior-day {
  height: 76px;
  min-height: 76px;
  max-height: 76px;
}

@media (max-width: 720px) {
  .calendar-day {
    height: 96px;
    min-height: 96px;
    max-height: 96px;
  }

  .behavior-day {
    height: 64px;
    min-height: 64px;
    max-height: 64px;
  }
}

.todo-check {
  display: inline-flex;
  align-items: center;
  min-width: 22px;
}

.todo-check input {
  width: auto;
}

.warning-panel {
  border: 1px solid #f0b429;
  background: #fff8e6;
  color: #7a4b00;
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 6px;
}

.warning-panel ul {
  margin: 0;
  padding-left: 18px;
}

.storage-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel-soft);
}

.storage-bar {
  height: 10px;
  border-radius: 999px;
  background: #edf2f7;
  overflow: hidden;
  margin: 8px 0;
}

.storage-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(135deg, var(--primary), var(--green));
}

@media (max-width: 720px) {
  .calendar-day {
    height: 96px;
    min-height: 96px;
    max-height: 96px;
  }
}

* {
  box-sizing: border-box;
}

html {
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(420px, 0.95fr) minmax(360px, 460px);
  align-items: center;
  gap: 34px;
  padding: clamp(22px, 4vw, 56px);
  background: radial-gradient(circle at 18% 18%, rgba(255, 213, 128, 0.35), transparent 28%), radial-gradient(circle at 82% 18%, rgba(78, 205, 196, 0.28), transparent 30%), linear-gradient(135deg, #eaf8ff 0%, #f7fbf1 55%, #fff5eb 100%);
  background-size: cover;
}

.login-hero {
  color: var(--text);
  padding: clamp(26px, 4vw, 48px);
  min-height: 520px;
  border: 1px solid rgba(30, 136, 168, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.system-badge {
  width: fit-content;
  border: 1px solid rgba(30, 136, 168, 0.28);
  background: #e7f8fb;
  color: var(--primary-dark);
  padding: 7px 12px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 700;
}

.login-hero h1 {
  margin: 0;
  font-size: clamp(44px, 6vw, 72px);
  line-height: 1.08;
  letter-spacing: 0;
}

.login-brand-lockup {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 20px 0 12px;
  min-width: 0;
}

.login-brand-mark {
  width: clamp(88px, 10vw, 126px);
  aspect-ratio: 1;
  object-fit: contain;
  flex: 0 0 auto;
}

.login-hero p {
  max-width: 620px;
  margin: 0;
  font-size: 17px;
  line-height: 1.75;
  color: #465668;
}

.login-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.login-actions-row span {
  border: 1px solid rgba(239, 123, 69, 0.28);
  background: #fff7ed;
  color: #9a4b16;
  padding: 9px 12px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 14px;
}

.login-panel-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.login-panel {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 32px;
}

.login-panel h2 {
  margin: 0 0 8px;
  font-size: 24px;
}

.login-panel .muted {
  margin-bottom: 26px;
}

.form-row {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

label {
  font-size: 14px;
  color: #344054;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  border-radius: 6px;
  padding: 11px 12px;
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 180px;
  line-height: 1.7;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(35, 100, 170, 0.13);
}

.primary-btn,
.ghost-btn,
.text-btn {
  min-height: 40px;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.primary-btn {
  background: linear-gradient(135deg, var(--primary), #23a094);
  color: #fff;
}

.primary-btn:hover {
  background: var(--primary-dark);
}

.ghost-btn {
  background: #fff;
  border-color: var(--line-strong);
  color: var(--text);
}

.text-btn {
  background: transparent;
  color: var(--primary);
  border: 0;
  padding: 0 4px;
}

.text-btn.danger {
  color: var(--red);
}

.danger-btn {
  background: linear-gradient(135deg, #c2410c, var(--red));
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
}

.sidebar {
  background: linear-gradient(180deg, var(--sidebar-mid) 0%, var(--sidebar-deep) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.brand {
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.brand-logo {
  width: 46px;
  height: 46px;
  padding: 3px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.94);
  object-fit: contain;
}

.brand-copy {
  min-width: 0;
}

.brand-title {
  font-size: 20px;
  font-weight: 700;
}

.brand-subtitle {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.66);
  font-size: 13px;
}

.nav {
  padding: 14px 10px;
  display: grid;
  gap: 4px;
}

.nav a {
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  padding: 12px 12px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.nav a.active,
.nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
}

.nav-icon {
  width: 26px;
  height: 26px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex: 0 0 26px;
  font-size: 15px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.06);
}

.nav a.active .nav-icon,
.nav a:hover .nav-icon {
  border-color: rgba(255, 255, 255, 0.48);
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.sidebar-foot {
  margin-top: auto;
  padding: 16px 18px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 64px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar-title {
  min-width: 0;
}

.topbar h1 {
  margin: 0;
  font-size: 21px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.mobile-nav {
  display: none;
}

.content {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px;
}

.section {
  margin-bottom: 22px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 12px;
}

.section-head h2,
.panel h2,
.panel h3 {
  margin: 0;
  font-size: 18px;
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

.grid {
  display: grid;
  gap: 16px;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.two-col {
  grid-template-columns: minmax(0, 1fr) 360px;
}

.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel,
.stat-card,
.student-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(31, 42, 55, 0.04);
}

.panel {
  padding: 18px;
}

.stat-card {
  padding: 18px;
  min-height: 116px;
  position: relative;
  overflow: hidden;
}

.stat-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.stat-link:hover {
  border-color: rgba(30, 136, 168, 0.45);
  box-shadow: 0 12px 26px rgba(31, 42, 55, 0.1);
  transform: translateY(-1px);
}

.stat-card::after {
  content: "";
  position: absolute;
  width: 82px;
  height: 82px;
  right: -22px;
  top: -28px;
  border-radius: 50%;
  background: rgba(30, 136, 168, 0.1);
}

.accent-blue {
  border-top: 4px solid var(--primary);
}

.accent-orange {
  border-top: 4px solid var(--orange);
}

.accent-green {
  border-top: 4px solid var(--green);
}

.accent-pink {
  border-top: 4px solid var(--pink);
}

.stat-card .label {
  color: var(--muted);
  font-size: 14px;
}

.stat-card .value {
  margin-top: 12px;
  font-size: 30px;
  font-weight: 700;
}

.stat-card .exam-name {
  font-size: 24px;
  line-height: 1.25;
}

.stat-card .hint {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  background: #f7f9fc;
  color: #344054;
  font-weight: 700;
}

tr:last-child td {
  border-bottom: 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.tag.green {
  color: var(--green);
  background: #e7f5ee;
}

.tag.amber {
  color: var(--amber);
  background: #fff3dd;
}

.tag.red {
  color: var(--red);
  background: #fde8e7;
}

.tag.blue {
  color: var(--primary);
  background: #e8f1fb;
}

.tag.cyan {
  color: var(--cyan);
  background: #def7fb;
}

.basic-line {
  color: #475467;
  font-size: 14px;
  background: #f2fbfb;
  border: 1px solid #d5eeee;
  border-radius: 6px;
  padding: 9px 10px;
}

.list {
  display: grid;
  gap: 10px;
}

.todo-item,
.timeline-item,
.comm-item,
.result-item,
.note-item {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  border-radius: 7px;
  padding: 12px;
}

.todo-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.toolbar .search-input {
  flex: 1 1 260px;
}

.student-action-bar {
  margin-bottom: 10px;
}

.student-filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.student-filter-bar .search-input {
  flex: 1 1 360px;
  min-width: 240px;
}

.student-filter-select {
  flex: 0 1 136px;
  min-width: 118px;
}

.student-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.student-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(31, 42, 55, 0.04);
}

.score-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(31, 42, 55, 0.04);
}

.score-table {
  min-width: 1500px;
}

.score-table th,
.score-table td {
  white-space: nowrap;
}

.score-overview {
  margin-bottom: 14px;
}

.score-cell {
  display: grid;
  gap: 3px;
}

.score-cell span,
.score-edit-row small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  margin-top: 3px;
}

.rank-trend {
  display: inline-flex;
  align-items: center;
  margin-left: 5px;
  font-size: 12px;
  font-weight: 700;
}

.rank-trend.up {
  color: var(--green);
}

.rank-trend.down {
  color: var(--red);
}

.rank-trend.flat {
  color: var(--muted);
}

.student-table {
  min-width: 1080px;
}

.student-table th {
  white-space: nowrap;
}

.student-table td {
  vertical-align: top;
}

.row-number {
  width: 48px;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
}

.student-row:hover td {
  background: #f8fcff;
}

.row-tags,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.row-actions {
  white-space: nowrap;
}

.student-card {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.student-card:hover {
  border-color: rgba(30, 136, 168, 0.38);
  box-shadow: 0 10px 22px rgba(31, 42, 55, 0.08);
}

.student-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #e8f1fb;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex: 0 0 42px;
}

.student-main {
  display: flex;
  gap: 12px;
  min-width: 0;
}

.student-main strong {
  display: block;
  font-size: 17px;
  margin-bottom: 4px;
}

/* Final dashboard/student-list/topbar fixes. */
.topbar {
  z-index: 90 !important;
  background: #fff !important;
  box-shadow: 0 1px 0 var(--line);
}

.student-table th,
.student-table td {
  text-align: center !important;
  vertical-align: middle !important;
}

.student-table .student-main {
  justify-content: center;
  align-items: center;
  text-align: center;
}

.student-table .row-tags,
.student-table .row-actions {
  justify-content: center;
}

.student-table .row-number {
  margin: 0 auto;
}

.dashboard-reminder-item,
.dashboard-watch-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  cursor: default;
}

.dashboard-card-main {
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  text-align: left;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  cursor: pointer;
}

.dashboard-card-delete {
  white-space: nowrap;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.section-actions .dashboard-watch-controls {
  margin: 0;
}

.detailed-score-table .score-freeze {
  z-index: 20 !important;
}

.detailed-score-table th.score-freeze {
  z-index: 25 !important;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.mini {
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px;
}

.card-actions,
.detail-actions,
.modal-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.card-actions .primary-btn,
.card-actions .ghost-btn {
  flex: 1 1 128px;
}

.mini span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 16px;
}

.detail-bottom-grid {
  grid-template-columns: minmax(0, 1fr) 320px;
  align-items: start;
}

.detail-actions {
  justify-content: flex-end;
}

.detail-profile {
  display: flex;
  gap: 14px;
  align-items: center;
  min-width: 0;
}

.detail-profile .avatar {
  width: 58px;
  height: 58px;
  flex-basis: 58px;
  font-size: 20px;
}

.detail-profile h2 {
  margin: 0 0 6px;
  font-size: 23px;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.tab {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: #344054;
  border-radius: 6px;
  padding: 9px 12px;
}

.tab.active {
  border-color: var(--primary);
  color: var(--primary);
  background: #e8f1fb;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.info-item {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  padding: 12px;
  min-width: 0;
}

.info-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.info-item strong {
  display: block;
  overflow-wrap: anywhere;
}

.timeline {
  position: relative;
  display: grid;
  gap: 12px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 14px;
}

.score-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 52px;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
}

.score-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.score-edit-form {
  display: grid;
  gap: 10px;
}

.score-edit-row {
  display: grid;
  grid-template-columns: 88px 92px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  border-radius: 7px;
  padding: 10px;
}

.score-edit-row input {
  padding: 8px 10px;
}

.bar {
  height: 10px;
  background: #edf2f7;
  border-radius: 999px;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
}

.import-layout,
.import-layout-wide,
.search-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 16px;
}

.import-layout-wide {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.72fr);
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.auto-detect-panel {
  border: 1px solid rgba(30, 136, 168, 0.24);
  background: linear-gradient(135deg, #effbfd, #fffaf0);
  border-radius: 8px;
  padding: 13px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.auto-detect-panel div {
  display: grid;
  gap: 5px;
}

.auto-detect-panel span:not(.tag) {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.source-card {
  min-height: 92px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 8px;
  text-align: left;
}

.source-card strong {
  font-size: 15px;
}

.source-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.source-card {
  border-left: 4px solid rgba(30, 136, 168, 0.36);
}

.upload-box {
  border: 1px dashed var(--line-strong);
  background: #fbfdff;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 14px;
  display: grid;
  gap: 8px;
}

.diversion-grid {
  display: grid;
  gap: 12px;
}

.main {
  background: var(--canvas-cool);
}

.login-hero {
  position: relative;
  overflow: hidden;
}

.login-hero > :not(.login-motion-graphic) {
  position: relative;
  z-index: 1;
}

.login-motion-graphic {
  position: absolute;
  inset: auto -4% 3% 8%;
  width: 96%;
  height: auto;
  color: var(--primary);
  pointer-events: none;
  opacity: 0.54;
}

.login-motion-path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 9 10;
  animation: login-path-flow 14s linear infinite;
}

.login-motion-path.path-two {
  color: #d98357;
  opacity: 0.62;
  animation-duration: 18s;
  animation-direction: reverse;
}

.login-motion-node {
  fill: #fff;
  stroke: currentColor;
  stroke-width: 2;
  transform-box: fill-box;
  transform-origin: center;
  animation: login-node-breathe 4.8s ease-in-out infinite;
}

.login-motion-node path {
  fill: none;
}

.login-motion-node.node-two { animation-delay: -1.6s; }
.login-motion-node.node-three { animation-delay: -3.1s; }

@keyframes login-path-flow {
  to { stroke-dashoffset: -190; }
}

@keyframes login-node-breathe {
  0%, 100% { opacity: 0.62; transform: scale(0.94); }
  50% { opacity: 1; transform: scale(1.08); }
}

@media (prefers-reduced-motion: reduce) {
  .login-motion-path,
  .login-motion-node {
    animation: none;
  }
}

.import-layout-wide .source-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.material-review-summary,
.material-review-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.material-review-summary {
  padding: 10px 0 2px;
  justify-content: space-between;
}

.material-review-counts,
.material-review-toolbar,
.material-review-title-actions,
.material-draft-select {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.material-draft-select {
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: nowrap;
  white-space: nowrap;
}

.material-draft-select input {
  margin: 0;
}

.material-review-item {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.material-review-item h3,
.material-review-item .material-review-content,
.material-evidence span,
.material-reason {
  margin: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.55;
}

.material-review-item.written,
.material-review-item.ignored {
  opacity: 0.72;
}

.material-evidence {
  display: grid;
  gap: 4px;
  border-left: 3px solid rgba(30, 136, 168, 0.36);
  padding: 7px 9px;
  background: rgba(239, 251, 253, 0.7);
  border-radius: 4px;
  font-size: 13px;
}

.material-review-actions {
  justify-content: flex-end;
  padding-top: 2px;
}

.material-draft-editor {
  width: min(760px, 100%);
}

.material-draft-editor textarea {
  min-height: 180px;
}

.material-merge-editor {
  background: var(--surface, #fff);
}

.material-merge-conflict {
  margin: 0 0 12px;
}

.import-progress {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: #e8eef5;
  margin-top: 12px;
}

.import-progress span {
  display: block;
  width: 42%;
  height: 100%;
  background: linear-gradient(90deg, #1e88a8, #55b879);
  animation: importProgress 1.1s ease-in-out infinite alternate;
}

@keyframes importProgress {
  from { transform: translateX(-40%); }
  to { transform: translateX(150%); }
}

.result-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.empty {
  border: 1px dashed var(--line-strong);
  background: #fff;
  color: var(--muted);
  border-radius: 8px;
  padding: 24px;
  text-align: center;
}

.ai-search-box {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.ai-search-box input {
  min-width: 0;
}

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
}

.calendar-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(31, 42, 55, 0.04);
  padding: 14px;
}

.calendar-week,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.calendar-week {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.calendar-empty,
.calendar-day {
  min-height: 126px;
  border-radius: 8px;
}

.behavior-filter-panel {
  margin-bottom: 16px;
}

.range-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.range-controls select,
.range-controls input {
  min-width: 150px;
  max-width: 190px;
}

.behavior-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 360px);
  gap: 14px;
}

.behavior-calendar {
  margin-top: 12px;
}

.behavior-day-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.behavior-day {
  min-height: 58px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
}

.behavior-day:hover {
  border-color: var(--primary);
  background: #f1fbfd;
}

.behavior-day.out-range {
  opacity: 0.42;
  cursor: not-allowed;
  background: #f8fafc;
}

.behavior-day span {
  min-height: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
}

.behavior-day em {
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #e6f5f8;
  color: var(--primary-dark);
  font-style: normal;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 4px;
}

.dot.plus {
  background: var(--green);
}

.dot.minus {
  background: var(--red);
}

.day-record-list {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.day-record-head {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.compact-btn {
  width: auto;
  min-height: 36px;
  padding: 0 14px;
}

.behavior-record {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  border-radius: 7px;
  padding: 12px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.behavior-record > div:nth-child(2) {
  flex: 1;
  min-width: 0;
}

.record-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.dimension-summary {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.dimension-row {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 10px;
  color: var(--text);
  cursor: pointer;
}

.dimension-row.active,
.dimension-row:hover {
  border-color: var(--primary);
  background: #f1fbfd;
}

.dimension-row > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.dimension-count-pair {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 8px !important;
}

.dimension-count {
  border-radius: 8px !important;
  padding: 8px 10px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  font-weight: 700 !important;
}

.dimension-count b {
  font-size: 13px !important;
}

.dimension-count strong {
  font-size: 20px !important;
}

.dimension-count.positive {
  background: #e9f8ef !important;
  color: #16703b !important;
}

.dimension-count.negative {
  background: #fdecec !important;
  color: #b42318 !important;
}

.dimension-rule-panel {
  border: 1px dashed var(--line);
  background: var(--panel-soft);
  border-radius: 8px;
  padding: 10px;
}

.compact-empty {
  padding: 14px;
}

.rule-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--text);
}

.rule-head span {
  color: var(--muted);
  font-size: 12px;
}

.rule-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.rule-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.chat-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

.chat-panel {
  min-height: 0;
  height: min(960px, calc(100vh - 112px));
  display: grid;
  grid-template-rows: minmax(520px, 1fr) auto;
  gap: 14px;
}

.chat-stream {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  padding: 4px;
}

.chat-message {
  display: flex;
}

.chat-message.user {
  justify-content: flex-end;
}

.chat-message-flash .bubble {
  animation: chatFocusFlash 1.2s ease-in-out 2;
}

.bubble {
  max-width: min(680px, 86%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  line-height: 1.75;
  background: #fff;
  white-space: normal;
}

.chat-message.user .bubble {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), #23a094);
}

.chat-message.user .chat-message-time {
  color: rgba(255, 255, 255, 0.78);
}

.chat-message.assistant .bubble {
  background: var(--panel-soft);
}

.chat-message-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.chat-copy-btn {
  flex: 0 0 auto;
  border: 0;
  padding: 2px 4px;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-size: 12px;
  line-height: 1.4;
  cursor: pointer;
}

.chat-message.user .chat-copy-btn {
  color: rgba(255, 255, 255, 0.9);
}

.chat-message-content {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.bubble.typing::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 16px;
  margin-left: 3px;
  vertical-align: -3px;
  background: var(--primary);
  animation: blink 0.8s infinite;
}

@keyframes blink {
  0%, 45% { opacity: 1; }
  46%, 100% { opacity: 0; }
}

@keyframes chatFocusFlash {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 148, 159, 0); }
  45% { box-shadow: 0 0 0 5px rgba(34, 148, 159, 0.18); }
}

.ai-side-column {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.chat-history-panel {
  min-width: 0;
}

.chat-history-list {
  display: grid;
  gap: 8px;
  max-height: 300px;
  overflow: auto;
  margin-top: 10px;
}

.chat-history-item {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
  text-align: left;
  line-height: 1.45;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.chat-history-item span,
.chat-history-item strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.chat-history-item span {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
  font-weight: 500;
}

.chat-history-item strong {
  font-size: 14px;
  font-weight: 600;
}

.chat-history-item:hover {
  border-color: rgba(34, 148, 159, 0.55);
  background: #f3fbfc;
  transform: translateY(-1px);
}

.chat-input {
  display: flex;
  gap: 10px;
}

.chat-input input {
  min-width: 0;
}

.calendar-day {
  border: 1px solid var(--line);
  background: #fbfdff;
  color: var(--text);
  padding: 9px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  text-align: left;
  overflow: hidden;
}

.calendar-day:hover {
  border-color: var(--primary);
  background: #f1fbfd;
}

.calendar-chip {
  width: 100%;
  border-radius: 5px;
  padding: 5px 6px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--primary-dark);
  background: #e8f1fb;
  overflow-wrap: anywhere;
}

.calendar-chip.amber {
  color: var(--amber);
  background: #fff3dd;
}

.calendar-chip.red {
  color: var(--red);
  background: #fde8e7;
}

.calendar-chip.green {
  color: var(--green);
  background: #e7f5ee;
}

.calendar-more-select {
  width: 100%;
  height: 28px;
  min-height: 28px;
  margin-top: 3px;
  padding: 0 24px 0 6px;
  font-size: 12px;
  line-height: 26px;
  border-radius: 5px;
}

.event-row {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--text);
  border-radius: 7px;
  padding: 12px;
  display: grid;
  gap: 7px;
  text-align: left;
}

.event-main {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  display: grid;
  gap: 7px;
  text-align: left;
  cursor: pointer;
}

.event-row small {
  color: var(--muted);
  line-height: 1.5;
}

.quick-record-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.9fr);
  gap: 16px;
  align-items: start;
}

.quick-record-panel {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  border-radius: 8px;
  padding: 12px;
}

.quick-record-scroll,
.focus-list-scroll {
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}

.quick-record-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.quick-record-item:last-child {
  border-bottom: 0;
}

.model-note {
  margin-top: 8px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.42);
}

.modal {
  width: min(860px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
  padding: 20px;
}

.detail-modal {
  width: min(1180px, 100%);
  padding: 18px;
}

.student-detail-backdrop {
  align-items: flex-start;
  padding-top: 18px;
}

.sticky-modal-head {
  position: sticky;
  top: -18px;
  z-index: 2;
  background: #fff;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.small-modal {
  width: min(520px, 100%);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.modal-head h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.modal-actions {
  justify-content: flex-end;
  margin-top: 16px;
}

@media (max-width: 980px) {
  .login-page,
  .app-shell,
  .two-col,
  .detail-bottom-grid,
  .import-layout,
  .import-layout-wide,
  .calendar-layout,
  .behavior-layout,
  .quick-record-layout,
  .chat-page,
  .search-layout {
    grid-template-columns: 1fr;
  }

  .login-hero {
    min-height: auto;
    padding: 34px 28px;
  }

  .login-panel-wrap {
    padding: 20px 20px 38px;
  }

  .sidebar {
    display: none;
  }

  .mobile-nav {
    display: block;
    max-width: 190px;
  }

  .stats-grid,
  .student-grid,
  .three-col,
  .info-grid,
  .source-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .login-page {
    min-height: auto;
    padding: 12px;
    gap: 14px;
  }

  .login-hero {
    padding: 30px 18px 14px;
  }

  .login-brand-lockup {
    gap: 12px;
  }

  .login-brand-mark {
    width: 74px;
  }

  .login-hero p {
    font-size: 15px;
  }

  .login-actions-row,
  .stats-grid,
  .student-grid,
  .three-col,
  .mini-grid,
  .info-grid,
  .form-grid,
  .source-grid,
  .calendar-week,
  .calendar-grid {
    grid-template-columns: 1fr;
  }

  .login-actions-row {
    display: grid;
  }

  .login-panel {
    padding: 22px;
  }

  .topbar {
    padding: 12px;
    min-height: auto;
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
  }

  .mobile-nav {
    flex: 1;
    max-width: none;
  }

  .content {
    padding: 16px 12px 24px;
  }

  .section-head,
  .detail-head,
  .todo-item,
  .student-card-head,
  .auto-detect-panel,
  .day-record-head,
  .rule-head {
    align-items: stretch;
    flex-direction: column;
  }

  .card-actions,
  .detail-actions,
  .modal-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .detail-head {
    gap: 14px;
  }

  .timeline-item,
  .score-row,
  .score-edit-row,
  .score-summary {
    grid-template-columns: 1fr;
  }

  .ai-search-box {
    flex-direction: column;
  }

  .primary-btn,
  .ghost-btn {
    width: 100%;
  }

  .modal-backdrop {
    padding: 10px;
    align-items: flex-start;
  }

  .modal {
    max-height: calc(100vh - 20px);
    padding: 16px;
  }

  .tabs .tab {
    flex: 1 1 calc(50% - 8px);
  }

  .calendar-empty {
    display: none;
  }

  .calendar-week {
    display: none;
  }

  .calendar-day {
    min-height: auto;
  }

  .range-controls {
    justify-content: stretch;
  }

  .range-controls select,
  .range-controls input {
    flex: 1 1 100%;
    min-width: 0;
  }

  .behavior-day-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .behavior-day {
    min-height: 62px;
  }

  .compact-btn {
    width: 100%;
  }

  .chat-panel {
    min-height: 580px;
  }

  .chat-input {
    flex-direction: column;
  }
}

.chat-stream-fixed {
  height: min(76vh, 760px);
  min-height: 560px;
  overflow-y: auto;
}

.focus-list-scroll {
  max-height: 340px;
}

.quick-record-layout {
  margin-top: 12px;
}

.calendar-day {
  height: 126px;
  min-height: 126px;
  max-height: 126px;
}

.calendar-chip {
  flex: 0 0 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.memo-scroll {
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}

/* Final responsive overrides for the detail modal and memo hub. */
.student-detail-backdrop {
  padding: clamp(8px, 1vw, 16px);
  align-items: stretch;
}

.student-detail-backdrop .detail-modal {
  width: min(96vw, 1760px);
  max-width: none;
  max-height: calc(100vh - 16px);
  min-height: min(900px, calc(100vh - 16px));
  padding: clamp(16px, 1.4vw, 24px);
}

.detail-modal .behavior-layout {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  align-items: start;
}

.detail-modal .behavior-day-grid {
  grid-auto-rows: 76px;
  align-content: start;
  gap: 8px;
}

.detail-modal .behavior-day,
.detail-modal .calendar-empty {
  height: 76px;
  min-height: 76px;
  max-height: 76px;
}

@media (min-width: 1440px) {
  .student-detail-backdrop .detail-modal {
    width: min(97vw, 1840px);
  }

  .detail-modal .behavior-day-grid {
    grid-auto-rows: 82px;
  }

  .detail-modal .behavior-day,
  .detail-modal .calendar-empty {
    height: 82px;
    min-height: 82px;
    max-height: 82px;
  }
}

@media (max-width: 720px) {
  .student-detail-backdrop .detail-modal {
    width: calc(100vw - 16px);
    min-height: auto;
    max-height: calc(100vh - 16px);
  }

  .detail-modal .behavior-day-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 66px;
  }

  .detail-modal .behavior-day,
  .detail-modal .calendar-empty {
    height: 66px;
    min-height: 66px;
    max-height: 66px;
  }
}

/* Score table readability pass: final overrides for stronger scroll controls and two-by-two metrics. */
.student-table th {
  text-align: center;
  vertical-align: middle;
}

.score-scroll-shell {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 46px;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}

.score-scroll-shell-bottom {
  margin-top: 10px;
}

.score-scroll-top,
.score-scroll-bottom {
  height: 34px;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid #c7dde7;
  border-radius: 999px;
  background: #f2f8fb;
  scrollbar-width: auto;
  scrollbar-color: #167c91 #dcecf2;
}

.score-scroll-top::before {
  content: none !important;
}

.score-scroll-top > div,
.score-scroll-bottom > div {
  height: 1px;
}

.score-scroll-top::-webkit-scrollbar,
.score-scroll-bottom::-webkit-scrollbar,
.score-table-wrap::-webkit-scrollbar {
  height: 18px;
}

.score-scroll-top::-webkit-scrollbar-track,
.score-scroll-bottom::-webkit-scrollbar-track,
.score-table-wrap::-webkit-scrollbar-track {
  background: #dcecf2;
  border-radius: 999px;
}

.score-scroll-top::-webkit-scrollbar-thumb,
.score-scroll-bottom::-webkit-scrollbar-thumb,
.score-table-wrap::-webkit-scrollbar-thumb {
  min-width: 72px;
  background: linear-gradient(90deg, #14869a, #0f6f84);
  border: 3px solid #dcecf2;
  border-radius: 999px;
}

.score-scroll-arrow {
  width: 46px;
  height: 34px;
  border: 1px solid #0f7f94;
  border-radius: 10px;
  background: linear-gradient(180deg, #f5fcff, #dff2f7);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(15, 111, 132, 0.16);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.score-scroll-arrow:hover {
  background: linear-gradient(180deg, #ffffff, #ccebf2);
  box-shadow: 0 5px 14px rgba(15, 111, 132, 0.24);
  transform: translateY(-1px);
}

.score-scroll-arrow span {
  position: relative;
  display: block;
  width: 25px;
  height: 3px;
  border-radius: 999px;
  background: #0b5f72;
}

.score-scroll-arrow-right span::after,
.score-scroll-arrow-left span::before {
  content: "";
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  border-color: #0b5f72;
  border-style: solid;
}

.score-scroll-arrow-right span::after {
  right: -1px;
  border-width: 3px 3px 0 0;
  transform: translateY(-50%) rotate(45deg);
}

.score-scroll-arrow-left span::before {
  left: -1px;
  border-width: 0 0 3px 3px;
  transform: translateY(-50%) rotate(45deg);
}

.score-table-wrap:has(.detailed-score-table) {
  overflow-x: auto;
}

.detailed-score-table {
  width: max-content;
  max-width: none;
  table-layout: fixed;
  font-size: 14px;
}

.detailed-score-table .score-col-total {
  width: 180px;
}

.detailed-score-table .score-col-rank {
  width: 148px;
}

.detailed-score-table .score-col-subject {
  width: 190px;
}

.detailed-score-table th,
.detailed-score-table td {
  font-size: 14px;
  line-height: 1.45;
  white-space: nowrap;
  overflow: visible;
  word-break: normal;
  overflow-wrap: normal;
  padding: 8px 10px;
  vertical-align: middle;
}

.detailed-score-table th {
  font-size: 14.5px;
  text-align: center;
}

.detailed-score-table .score-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 8px;
  align-items: center;
  width: 100%;
}

.detailed-score-table .score-stack > *:not(:last-child)::after {
  content: none;
}

.detailed-score-table .score-cell-line {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  min-width: 0;
  color: #365365;
  font-size: 13.5px;
  white-space: nowrap;
}

.detailed-score-table .score-cell-line b {
  flex: 0 0 auto;
  min-width: 2.1em;
  color: #516b7a;
  font-weight: 700;
}

.detailed-score-table .score-field-button {
  justify-content: center;
  gap: 3px;
  font-size: 13.5px;
  white-space: nowrap;
  flex-wrap: nowrap;
}

.detailed-score-table .score-field-button strong {
  font-size: 14.5px;
}

.detailed-score-table .score-trend {
  font-size: 12.5px;
}
.score-empty-slash {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  width: 100%;
  color: #64748b;
  font-weight: 700;
}

/* Final July 10 fixes: score table layering, fixed calendar cards, centered lists, and quick-review clarity. */
.topbar,
.section-head,
.score-controls,
.score-overview {
  position: relative;
  z-index: 90;
}

.score-scroll-shell-top {
  position: sticky;
  top: 0;
  z-index: 95;
  background: #f3f8fb;
  padding: 4px 0;
}

.score-table-wrap {
  position: relative;
  z-index: 1;
  max-width: 100%;
}

.detailed-score-table thead th {
  position: sticky !important;
  top: 0;
}

.detailed-score-table th,
.detailed-score-table td {
  border-right: 1px solid #6b7280 !important;
  border-bottom: 1px solid #7b8792 !important;
  background-color: #fff !important;
  text-align: center !important;
}

.detailed-score-table th {
  background-color: #eef8fb !important;
}

.detailed-score-table .score-freeze {
  background-color: #fff !important;
  transform: translateZ(0);
}

.detailed-score-table th.score-freeze {
  background-color: #eef8fb !important;
}

.detailed-score-table .score-stack {
  grid-template-columns: repeat(2, max-content) !important;
  justify-content: center !important;
  justify-items: center !important;
  gap: 4px 10px !important;
}

.score-no-raw.score-no-elective .score-stack {
  grid-template-columns: max-content !important;
}

.student-table th,
.student-table td {
  text-align: center !important;
  vertical-align: middle !important;
}

.student-table .student-main,
.student-table .row-tags,
.student-table .row-actions {
  justify-content: center;
}

.calendar-list,
.memo-month-list .memo-scroll {
  align-content: start;
}

.calendar-list .event-row,
.memo-month-list .event-row {
  min-height: 116px !important;
  height: 116px !important;
  max-height: 116px !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 54px !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 10px 12px !important;
}

.calendar-list .event-main,
.memo-month-list .event-main {
  min-width: 0;
  height: 100%;
  align-content: center;
  text-align: left;
}

.calendar-list .event-main strong,
.memo-month-list .event-main strong {
  display: block;
  white-space: normal !important;
  overflow: visible !important;
  line-height: 1.35;
}

.calendar-list .event-main small,
.memo-month-list .event-main small {
  display: block;
  white-space: normal !important;
  overflow: visible !important;
  line-height: 1.35;
  margin-top: 8px;
}

.calendar-list .event-row .danger,
.memo-month-list .event-row .danger {
  justify-self: end;
  align-self: center;
}

.quick-review-extra {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.quick-review-extra span {
  border-radius: 999px;
  background: #eef7fb;
  color: #315466;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 700;
}

.quick-review-extra .quick-positive {
  background: #e7f8ef;
  color: #08733f;
}

.quick-review-extra .quick-negative {
  background: #fff1f2;
  color: #be123c;
}

.settings-date-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.settings-date-row .form-row {
  margin: 0;
}

.comm-tabs {
  margin-top: 12px;
}

.student-event-log {
  margin-top: 16px;
  border-top: 1px solid #d9e7ef;
  padding-top: 12px;
}

.student-event-log-head {
  font-weight: 800;
  margin-bottom: 10px;
}

.event-log-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 8px 0;
  border-bottom: 1px solid #edf3f6;
}

.event-log-item small {
  display: block;
  color: #5d7281;
  line-height: 1.4;
}

.admin-table-wrap {
  overflow: visible !important;
}

.admin-table {
  table-layout: fixed;
  width: 100%;
}

.admin-table th,
.admin-table td {
  white-space: normal;
  overflow-wrap: anywhere;
  vertical-align: middle;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
  color: #fff;
  display: block;
}

/* Final layout overrides for the July dashboard, score table, detail and admin fixes. */
.dashboard-home {
  display: grid;
  gap: 14px;
  min-height: calc(100vh - 112px);
}

.dashboard-info-strip {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) repeat(4, max-content);
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid #d5e5ed;
  border-radius: 10px;
  background: #f7fcfe;
}

.dashboard-info-strip > div,
.dashboard-info-strip > a,
.dashboard-info-strip > span {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: #315466;
  text-decoration: none;
  white-space: nowrap;
}

.dashboard-info-strip strong {
  color: #06233b;
}

.dashboard-info-strip span {
  color: #587080;
}

.dashboard-top-panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 1fr);
  gap: 14px;
  align-items: stretch;
}

.dashboard-focus-panel,
.dashboard-reminder-panel,
.dashboard-quick-section {
  min-width: 0;
}

.dashboard-focus-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-focus-block {
  min-width: 0;
  display: grid;
  gap: 10px;
  align-content: start;
}

.dashboard-block-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.dashboard-block-head h3 {
  margin: 0;
}

.dashboard-focus-summary {
  width: 100%;
  border: 1px solid #d5e5ed;
  background: #f3fbfe;
  border-radius: 8px;
  padding: 8px 10px;
  color: #315466;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
}

.dashboard-focus-summary.praise {
  background: #f0fbf5;
}

.dashboard-focus-summary strong {
  color: #0f8091;
  font-size: 22px;
}

.dashboard-focus-summary span {
  font-size: 13px;
}

.dashboard-quick-section .quick-record-layout {
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
  min-height: 340px;
}

.dashboard-quick-section .quick-record-input {
  min-height: 210px;
}

.dashboard-quick-section .quick-record-scroll {
  max-height: 294px;
}

.dashboard-panel-flash {
  animation: dashboard-panel-flash-fill 1.2s ease-in-out 0s 2;
}

@keyframes dashboard-panel-flash-fill {
  0%, 100% { background: #fff; box-shadow: 0 0 0 1px #d5e5ed; }
  50% { background: #e8f8fc; box-shadow: 0 0 0 3px rgba(15, 143, 163, .28); }
}

@media (max-width: 1180px) {
  .dashboard-info-strip,
  .dashboard-top-panels,
  .dashboard-focus-columns,
  .dashboard-quick-section .quick-record-layout {
    grid-template-columns: 1fr;
  }
}

.score-section-card {
  position: relative;
  z-index: 1;
}

.score-scroll-shell-top {
  position: sticky !important;
  top: 0 !important;
  z-index: 80 !important;
  background: #f3f9fc !important;
  padding: 6px 0 !important;
}

.score-table-wrap {
  max-height: calc(100vh - 230px);
  overflow: auto !important;
  position: relative;
  z-index: 1;
  background: #fff;
  border: 1px solid #6f7b86 !important;
}

.detailed-score-table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

.detailed-score-table th,
.detailed-score-table td {
  border-right: 1px solid #6f7b86 !important;
  border-bottom: 1px solid #6f7b86 !important;
  background-clip: padding-box !important;
  text-align: center !important;
  vertical-align: middle !important;
}

.detailed-score-table thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 56 !important;
  background: #eef8fb !important;
}

.detailed-score-table thead th.score-freeze {
  z-index: 76 !important;
}

.detailed-score-table .score-freeze {
  position: sticky !important;
  background: #fff !important;
  z-index: 46 !important;
  box-shadow: inset -1px 0 0 #6f7b86, inset 0 -1px 0 #6f7b86 !important;
}

.detailed-score-table th.score-freeze {
  background: #eef8fb !important;
}

.detailed-score-table .score-freeze-total {
  box-shadow: inset -1px 0 0 #6f7b86, inset 0 -1px 0 #6f7b86, 4px 0 0 #56616b !important;
}

.detailed-score-table .score-freeze-total .score-stack,
.detailed-score-table:not(.score-no-raw) .score-freeze-total .score-stack {
  grid-template-columns: 1fr !important;
  justify-content: center !important;
  justify-items: center !important;
  align-items: center !important;
  gap: 4px !important;
}

.detailed-score-table .score-freeze-total .score-cell-line {
  white-space: nowrap !important;
  justify-content: center !important;
}

.detailed-score-table.score-no-raw .score-freeze-total .score-stack {
  grid-template-columns: max-content !important;
}

.score-sort-actions,
.score-header-actions {
  justify-content: center !important;
  align-items: center !important;
}

.score-sort-actions:has(> :only-child),
.score-header-actions:has(> :only-child) {
  display: flex !important;
}

.score-cell-line,
.subject-score-line,
.rank-summary-line {
  justify-content: center !important;
  text-align: center !important;
}

.detail-modal .behavior-layout-with-log,
.behavior-layout-with-log {
  display: grid !important;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr) !important;
  gap: 14px !important;
  align-items: start !important;
}

.behavior-main-area {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(250px, .9fr);
  gap: 12px;
  min-width: 0;
}

.behavior-calendar-column,
.behavior-summary-column,
.behavior-event-log-panel {
  min-width: 0;
}

.behavior-layout-with-log .behavior-day-grid {
  grid-auto-rows: 58px;
}

.behavior-day.selected {
  border-color: #0f8fa3 !important;
  background: #e7f8fc !important;
  box-shadow: 0 0 0 2px rgba(15, 143, 163, .18) !important;
}

.behavior-event-log-panel {
  border-left: 1px solid #d9e7ef;
  padding-left: 14px;
  max-height: 520px;
  overflow: auto;
}

.student-event-log {
  margin-top: 0 !important;
  border-top: 0 !important;
  padding-top: 0 !important;
}

@media (max-width: 1100px) {
  .detail-modal .behavior-layout-with-log,
  .behavior-layout-with-log,
  .behavior-main-area {
    grid-template-columns: 1fr !important;
  }
}

.admin-table-wrap {
  overflow-x: auto !important;
  overflow-y: visible !important;
}

.admin-table {
  table-layout: fixed !important;
  width: 100% !important;
  min-width: 1080px !important;
}

.admin-table th,
.admin-table td {
  vertical-align: middle !important;
  word-break: normal !important;
  overflow-wrap: anywhere !important;
  line-height: 1.45 !important;
}

.admin-table th:nth-child(1),
.admin-table td:nth-child(1) {
  width: 260px !important;
}

.admin-table th:nth-child(6),
.admin-table td:nth-child(6) {
  width: 260px !important;
}

.admin-table th:nth-child(7),
.admin-table td:nth-child(7) {
  width: 88px !important;
  text-align: center !important;
}

.admin-email-cell strong {
  display: block !important;
  white-space: normal !important;
  word-break: normal !important;
  overflow-wrap: anywhere !important;
}

/* Final fixes: dashboard card density, student detail log, settings and admin table. */
.dashboard-focus-panel .section-head,
.dashboard-reminder-panel .section-head {
  align-items: flex-start !important;
}

.dashboard-focus-columns {
  grid-template-columns: repeat(2, minmax(260px, 1fr)) !important;
}

.dashboard-block-head {
  display: grid !important;
  grid-template-columns: minmax(0, 92px) minmax(0, 1fr) !important;
  align-items: start !important;
}

.dashboard-block-head h3 {
  writing-mode: horizontal-tb !important;
  white-space: normal !important;
  line-height: 1.25 !important;
}

.dashboard-block-head .section-actions,
.dashboard-block-head .dashboard-watch-controls {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  min-width: 0 !important;
}

.dashboard-block-head .dashboard-watch-controls label {
  display: inline-grid !important;
  grid-template-columns: auto 64px auto !important;
  align-items: center !important;
  gap: 6px !important;
  white-space: normal !important;
  min-width: 0 !important;
}

.dashboard-focus-panel .dashboard-item-grid,
.dashboard-reminder-panel .dashboard-item-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
  gap: 10px !important;
  align-items: start !important;
}

.dashboard-card-item,
.dashboard-watch-item,
.dashboard-reminder-item {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 8px !important;
  min-width: 0 !important;
  width: 100% !important;
  writing-mode: horizontal-tb !important;
}

.dashboard-card-main {
  display: block !important;
  min-width: 0 !important;
  text-align: left !important;
  writing-mode: horizontal-tb !important;
}

.dashboard-card-main strong,
.dashboard-card-main .muted,
.dashboard-card-main span,
.dashboard-watch-item strong,
.dashboard-reminder-item strong {
  writing-mode: horizontal-tb !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  line-height: 1.35 !important;
}

.dashboard-card-delete {
  white-space: nowrap !important;
  align-self: center !important;
}

.detail-modal .behavior-layout-with-log,
.behavior-layout-with-log {
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr) !important;
  overflow: hidden !important;
}

.behavior-main-area {
  grid-template-columns: minmax(0, 1fr) !important;
}

.behavior-layout-with-log .behavior-day-grid {
  grid-auto-rows: 54px !important;
}

.behavior-layout-with-log .behavior-day {
  min-width: 0 !important;
  overflow: hidden !important;
}

.behavior-summary-column .dimension-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}

.behavior-summary-column .dimension-rule-panel {
  grid-column: 1 / -1;
}

.behavior-event-log-panel {
  min-width: 0 !important;
  max-width: 100% !important;
}

.event-log-actionable {
  grid-template-columns: auto minmax(0, 1fr) auto !important;
}

.event-log-delete {
  white-space: nowrap;
}

.settings-date-pair {
  grid-column: 1 / -1;
}

.settings-date-row {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(220px, 1fr)) !important;
  gap: 12px !important;
  width: 100% !important;
}

.settings-date-row .form-row {
  min-width: 0 !important;
}

.settings-date-row input[type="date"] {
  width: 100% !important;
  min-width: 0 !important;
}

.month-day-selects {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.month-day-selects select {
  width: 100%;
  min-width: 0;
}

.admin-account-head {
  gap: 12px !important;
}

.admin-token-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  color: #315466;
  font-size: 13px;
  font-weight: 700;
}

.admin-token-filter select {
  min-width: 128px;
}

.admin-table-wrap {
  overflow-x: auto !important;
}

.admin-table {
  min-width: 1280px !important;
}

.admin-table th:nth-child(1),
.admin-table td:nth-child(1) {
  width: 230px !important;
}

.admin-table th:nth-child(2),
.admin-table td:nth-child(2) {
  width: 86px !important;
}

.admin-table th:nth-child(3),
.admin-table td:nth-child(3) {
  width: 170px !important;
}

.admin-table th:nth-child(6),
.admin-table td:nth-child(6) {
  width: 250px !important;
}

.admin-table th:nth-child(7),
.admin-table td:nth-child(7) {
  width: 96px !important;
}

.admin-table th:nth-child(8),
.admin-table td:nth-child(8) {
  width: 150px !important;
}

/* Final polish requested on July 10: focus blocks, behavior calendar, score import and admin rows. */
.dashboard-focus-columns {
  grid-template-columns: repeat(2, minmax(280px, 1fr)) !important;
  align-items: stretch !important;
}

.dashboard-focus-block {
  border: 1px solid #d5e5ed !important;
  border-radius: 10px !important;
  padding: 12px !important;
  background: #fbfdfe !important;
}

.dashboard-block-head {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
}

.dashboard-block-head h3 {
  writing-mode: horizontal-tb !important;
  white-space: nowrap !important;
  font-size: 18px !important;
  line-height: 1.3 !important;
}

.dashboard-watch-controls-row {
  display: block !important;
  border: 1px solid #dbe9f0 !important;
  border-radius: 8px !important;
  padding: 10px !important;
  background: #f6fbfd !important;
}

.dashboard-watch-controls-row .dashboard-watch-controls {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 8px !important;
}

.dashboard-watch-controls-row label {
  display: grid !important;
  grid-template-columns: auto minmax(58px, 1fr) auto !important;
  align-items: center !important;
  gap: 6px !important;
  white-space: normal !important;
}

.dashboard-watch-controls-row input {
  width: 100% !important;
  min-width: 0 !important;
}

.dashboard-focus-block .dashboard-card-item {
  min-height: 72px !important;
  padding: 10px 12px !important;
}

.dashboard-focus-block .tag {
  writing-mode: horizontal-tb !important;
  white-space: nowrap !important;
}

.detail-head-tags {
  margin-top: 8px !important;
}

.student-portrait-text {
  margin-top: 10px !important;
}

.behavior-layout-with-log {
  grid-template-columns: minmax(0, 64%) minmax(260px, 1fr) !important;
}

.behavior-calendar {
  width: 100% !important;
  overflow: hidden !important;
}

.behavior-day-grid {
  display: grid !important;
  grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
  gap: 6px !important;
  align-items: stretch !important;
}

.behavior-layout-with-log .behavior-day-grid,
.detail-modal .behavior-day-grid {
  grid-auto-rows: 46px !important;
}

.behavior-day {
  min-height: 0 !important;
  height: 46px !important;
  padding: 6px 7px !important;
  border-radius: 7px !important;
  overflow: hidden !important;
}

.behavior-day strong {
  font-size: 15px !important;
  line-height: 1 !important;
}

.behavior-day span {
  min-height: 12px !important;
  gap: 2px !important;
}

.behavior-day em {
  min-width: 16px !important;
  height: 16px !important;
  font-size: 11px !important;
}

.day-record-list {
  position: relative !important;
  z-index: 1 !important;
  margin-top: 10px !important;
}

.score-import-panel {
  border: 1px solid #d5e5ed !important;
  border-radius: 10px !important;
  background: #fbfdfe !important;
  padding: 14px !important;
  margin-bottom: 14px !important;
}

.score-import-fields {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(150px, .5fr) minmax(150px, .5fr) !important;
  gap: 12px !important;
  align-items: end !important;
  margin-top: 12px !important;
}

.score-import-fields .form-row {
  min-width: 0 !important;
  margin: 0 !important;
}

.score-import-fields input,
.score-import-fields select {
  width: 100% !important;
}

.admin-table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

.admin-table tr {
  min-height: 72px !important;
}

.admin-table th,
.admin-table td {
  height: auto !important;
  min-height: 72px !important;
  vertical-align: top !important;
  padding: 12px 10px !important;
}

.admin-table select.admin-compact-select {
  width: 100% !important;
  min-width: 82px !important;
  max-width: 120px !important;
}

.admin-table td:nth-child(4),
.admin-table td:nth-child(5),
.admin-table td:nth-child(7),
.admin-table td:nth-child(10) {
  vertical-align: middle !important;
}

.admin-table td:nth-child(6) {
  line-height: 1.65 !important;
}

@media (max-width: 1180px) {
  .dashboard-focus-columns,
  .score-import-fields {
    grid-template-columns: 1fr !important;
  }
}

/* July 10 layout repair: keep focus cards, detail modal header and admin rows stable. */
.dashboard-focus-panel {
  overflow: hidden !important;
}

.dashboard-focus-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 14px !important;
  min-width: 0 !important;
}

.dashboard-focus-block {
  min-width: 0 !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
}

.dashboard-watch-controls-row {
  overflow: hidden !important;
}

.dashboard-watch-controls-row .dashboard-watch-controls {
  display: block !important;
}

.dashboard-watch-controls-row label {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  white-space: nowrap !important;
  line-height: 1.4 !important;
  min-width: 0 !important;
}

.dashboard-watch-controls-row input {
  flex: 0 0 58px !important;
  width: 58px !important;
  min-width: 58px !important;
  height: 34px !important;
  padding: 6px 8px !important;
}

.dashboard-focus-block .dashboard-item-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)) !important;
  min-width: 0 !important;
}

.dashboard-focus-block .dashboard-card-item {
  min-width: 0 !important;
  overflow: hidden !important;
}

.dashboard-focus-block .dashboard-card-main {
  min-width: 0 !important;
  overflow: hidden !important;
}

.dashboard-focus-block .student-card-head {
  min-width: 0 !important;
}

.student-detail-backdrop {
  z-index: 1000 !important;
  align-items: flex-start !important;
  overflow: hidden !important;
  padding: 18px !important;
}

.student-detail-backdrop .detail-modal {
  position: relative !important;
  width: min(1180px, calc(100vw - 36px)) !important;
  max-height: calc(100vh - 36px) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 0 18px 18px !important;
  overscroll-behavior: contain !important;
}

.student-detail-backdrop .sticky-modal-head {
  position: sticky !important;
  top: 0 !important;
  z-index: 80 !important;
  margin: 0 -18px 16px !important;
  padding: 18px 18px 14px !important;
  background: #fff !important;
  border-bottom: 1px solid #d5e5ed !important;
  box-shadow: 0 8px 14px rgba(15, 61, 76, 0.08) !important;
}

.student-detail-backdrop .sticky-modal-head::before {
  content: "" !important;
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  top: -20px !important;
  height: 20px !important;
  background: #fff !important;
}

.student-detail-backdrop .sticky-modal-head .modal-close {
  position: relative !important;
  z-index: 2 !important;
  flex: 0 0 auto !important;
}

.student-detail-backdrop .detail-modal > :not(.sticky-modal-head) {
  position: relative !important;
  z-index: 1 !important;
}

.admin-table-wrap {
  overflow-x: visible !important;
}

.admin-table {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
  border-collapse: collapse !important;
}

.admin-table th,
.admin-table td {
  vertical-align: top !important;
  padding: 12px 10px !important;
  overflow: hidden !important;
}

.admin-table th:nth-child(1),
.admin-table td:nth-child(1) {
  width: 19% !important;
}

.admin-table th:nth-child(2),
.admin-table td:nth-child(2) {
  width: 7% !important;
}

.admin-table th:nth-child(3),
.admin-table td:nth-child(3) {
  width: 14% !important;
}

.admin-table th:nth-child(4),
.admin-table td:nth-child(4),
.admin-table th:nth-child(5),
.admin-table td:nth-child(5) {
  width: 9% !important;
}

.admin-table th:nth-child(6),
.admin-table td:nth-child(6) {
  width: 22% !important;
  line-height: 1.55 !important;
}

.admin-table th:nth-child(7),
.admin-table td:nth-child(7) {
  width: 7% !important;
}

.admin-table th:nth-child(8),
.admin-table td:nth-child(8) {
  width: 10% !important;
}

.admin-table th:nth-child(9),
.admin-table td:nth-child(9) {
  width: 9% !important;
}

.admin-table th:nth-child(10),
.admin-table td:nth-child(10) {
  width: 7% !important;
}

.admin-email-cell,
.admin-table td:nth-child(3),
.admin-table td:nth-child(6),
.admin-table td:nth-child(8),
.admin-table td:nth-child(9) {
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: normal !important;
}

.admin-email-cell strong {
  display: block !important;
  line-height: 1.35 !important;
}

.admin-table select.admin-compact-select {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  box-sizing: border-box !important;
}

@media (max-width: 1320px) {
  .dashboard-watch-controls-row label {
    flex-wrap: wrap !important;
    white-space: normal !important;
  }

  .admin-table {
    font-size: 13px !important;
  }

  .admin-table th,
  .admin-table td {
    padding: 10px 8px !important;
  }
}

/* Admin pages favor operator density over narrow customer-style layouts. */
.content:has(.admin-table-wrap) {
  max-width: none !important;
  padding-left: 18px !important;
  padding-right: 18px !important;
}

.section:has(.admin-table-wrap),
.section:has(.admin-stats-grid) {
  width: 100% !important;
}

.dashboard-watch-controls-row {
  padding: 8px 10px !important;
  overflow: visible !important;
}

.dashboard-watch-controls-row label {
  flex-wrap: nowrap !important;
  white-space: nowrap !important;
  gap: 4px !important;
  font-size: 13px !important;
}

.dashboard-watch-controls-row input {
  flex: 0 0 46px !important;
  width: 46px !important;
  min-width: 46px !important;
  height: 32px !important;
  padding: 5px 6px !important;
  text-align: center !important;
}

.dashboard-focus-block {
  overflow: visible !important;
}

.dashboard-focus-block .dashboard-item-grid,
.dashboard-focus-block .dashboard-card-item,
.dashboard-focus-block .dashboard-card-main {
  overflow: hidden !important;
}

.admin-table-wrap {
  overflow-x: auto !important;
  overflow-y: visible !important;
}

.admin-table {
  min-width: 1420px !important;
  table-layout: fixed !important;
}

.admin-table th,
.admin-table td {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
}

.admin-table th:nth-child(1),
.admin-table td:nth-child(1) {
  width: 250px !important;
}

.admin-table th:nth-child(2),
.admin-table td:nth-child(2) {
  width: 90px !important;
}

.admin-table th:nth-child(3),
.admin-table td:nth-child(3) {
  width: 170px !important;
}

.admin-table th:nth-child(4),
.admin-table td:nth-child(4),
.admin-table th:nth-child(5),
.admin-table td:nth-child(5) {
  width: 110px !important;
}

.admin-table th:nth-child(6),
.admin-table td:nth-child(6) {
  width: 270px !important;
}

.admin-table th:nth-child(7),
.admin-table td:nth-child(7) {
  width: 90px !important;
  text-align: center !important;
}

.admin-table th:nth-child(8),
.admin-table td:nth-child(8) {
  width: 130px !important;
}

.admin-table th:nth-child(9),
.admin-table td:nth-child(9) {
  width: 130px !important;
}

.admin-table th:nth-child(10),
.admin-table td:nth-child(10) {
  width: 80px !important;
}

.admin-email-cell,
.admin-email-cell strong {
  white-space: nowrap !important;
  overflow-wrap: normal !important;
  word-break: normal !important;
}

.admin-table select.admin-compact-select {
  min-width: 96px !important;
  width: 96px !important;
  height: 38px !important;
  padding: 0 28px 0 10px !important;
}

@media (max-width: 1320px) {
  .dashboard-watch-controls-row label {
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
  }
}

/* July 11 dashboard and memo density fixes. */
.dashboard-watch-controls-row {
  border: 0 !important;
  background: transparent !important;
  padding: 0 !important;
  overflow: visible !important;
}

.dashboard-watch-controls-row .dashboard-watch-controls {
  display: block !important;
}

.dashboard-watch-controls-row label {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  flex-wrap: wrap !important;
  white-space: normal !important;
  line-height: 1.35 !important;
}

.dashboard-stepper {
  display: inline-grid !important;
  grid-template-columns: 24px 32px 24px !important;
  align-items: center !important;
  gap: 2px !important;
  border: 1px solid #c9dce7 !important;
  border-radius: 8px !important;
  background: #fff !important;
  padding: 2px !important;
}

.dashboard-stepper button {
  width: 24px !important;
  height: 26px !important;
  border: 0 !important;
  border-radius: 6px !important;
  background: #eef8fb !important;
  color: #0f7890 !important;
  cursor: pointer !important;
  line-height: 1 !important;
}

.dashboard-stepper strong {
  text-align: center !important;
  font-size: 15px !important;
  line-height: 26px !important;
}

.dashboard-focus-block .dashboard-item-grid {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 8px !important;
  max-height: 426px !important;
  overflow-y: auto !important;
  padding-right: 4px !important;
}

.dashboard-reminder-panel .dashboard-item-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 8px !important;
  max-height: 426px !important;
  overflow-y: auto !important;
  padding-right: 4px !important;
}

.dashboard-focus-summary {
  display: none !important;
}

.dashboard-card-item,
.dashboard-watch-item,
.dashboard-reminder-item {
  min-height: 74px !important;
}

.memo-todo-panel {
  max-height: 560px !important;
  overflow: hidden !important;
}

.memo-todo-panel .memo-scroll {
  flex: 1 1 auto !important;
  max-height: 230px !important;
  overflow-y: auto !important;
}

.memo-todo-panel .todo-item {
  height: 86px !important;
  min-height: 86px !important;
  align-items: center !important;
  overflow: hidden !important;
}

.memo-todo-panel .todo-item > div {
  min-width: 0 !important;
  overflow: hidden !important;
}

.memo-todo-panel .todo-item strong,
.memo-todo-panel .todo-item .muted {
  display: -webkit-box !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
}

.memo-todo-panel .todo-item strong {
  -webkit-line-clamp: 1 !important;
}

.memo-todo-panel .todo-item .muted {
  -webkit-line-clamp: 2 !important;
}

.memo-note-list {
  max-height: 520px !important;
  overflow-y: auto !important;
}

.todo-item[data-edit-todo] {
  cursor: pointer;
}

.todo-item[data-edit-todo]:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

@media (max-width: 980px) {
  .dashboard-reminder-panel .dashboard-item-grid {
    grid-template-columns: 1fr !important;
  }
}

/* July 11 workspace expansion and dashboard work-log layout. */
.content {
  max-width: none !important;
  margin: 0 !important;
  padding: 24px clamp(18px, 2.2vw, 34px) !important;
}

.dashboard-work-layout {
  display: grid !important;
  grid-template-columns: minmax(280px, 1fr) minmax(0, 2fr) !important;
  gap: 14px !important;
  align-items: stretch !important;
}

.dashboard-work-log-panel,
.dashboard-quick-section {
  min-width: 0 !important;
}

.dashboard-quick-section {
  display: flex !important;
  flex-direction: column !important;
}

.work-log-scroll {
  display: grid !important;
  align-content: start !important;
  gap: 8px !important;
  max-height: 300px !important;
  overflow-y: auto !important;
  padding-right: 4px !important;
}

.work-log-item {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 8px !important;
  align-items: center !important;
  min-height: 58px !important;
  padding: 10px !important;
  border: 1px solid #d4e4ed !important;
  border-radius: 8px !important;
  background: #f8fcff !important;
}

.work-log-main {
  min-width: 0 !important;
  border: 0 !important;
  background: transparent !important;
  padding: 0 !important;
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) !important;
  gap: 8px !important;
  align-items: center !important;
  color: inherit !important;
  text-align: left !important;
  cursor: pointer !important;
}

.work-log-main strong,
.work-log-main .muted {
  display: block !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.work-log-main small {
  display: block !important;
  margin-top: 3px !important;
  color: #78909c !important;
}

.dashboard-watch-line {
  display: flex !important;
  gap: 8px !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
  min-width: 0 !important;
}

.dashboard-watch-line span:first-child {
  flex: 0 0 auto !important;
  color: #315466 !important;
}

.dashboard-watch-line span:last-child {
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.memo-todo-panel .memo-scroll {
  display: grid !important;
  align-content: start !important;
  gap: 8px !important;
  justify-content: stretch !important;
}

.memo-list-item:hover {
  transform: none !important;
}

.memo-top-layout {
  align-items: stretch !important;
}

.memo-main-panel,
.memo-todo-panel {
  height: 620px !important;
  min-height: 620px !important;
  overflow: hidden !important;
}

.memo-main-panel {
  display: flex !important;
  flex-direction: column !important;
}

.memo-main-head {
  flex: 0 0 auto !important;
  margin-bottom: 12px !important;
}

.memo-main-head .compact-toolbar {
  flex-wrap: nowrap !important;
  white-space: nowrap !important;
}

.memo-main-panel .memo-workspace {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  display: grid !important;
  grid-template-columns: minmax(260px, 0.36fr) minmax(0, 1fr) !important;
  gap: 0 !important;
  overflow: hidden !important;
}

.memo-main-panel .memo-list-panel,
.memo-main-panel .memo-editor-panel {
  min-height: 0 !important;
  height: 100% !important;
  border: 0 !important;
  background: transparent !important;
  padding: 0 !important;
  box-shadow: none !important;
}

.memo-main-panel .memo-list-panel {
  padding-right: 14px !important;
  border-right: 1px solid var(--line) !important;
  display: flex !important;
  flex-direction: column !important;
  min-width: 0 !important;
}

.memo-main-panel .memo-editor-panel {
  padding-left: 14px !important;
  min-width: 0 !important;
}

.memo-subhead {
  flex: 0 0 auto !important;
  margin-bottom: 10px !important;
}

.memo-subhead h3 {
  margin: 0 !important;
  font-size: 16px !important;
}

.memo-main-panel .memo-note-list {
  flex: 1 1 auto !important;
  max-height: none !important;
  overflow-y: auto !important;
}

.memo-main-panel .memo-editor-form,
.memo-main-panel .memo-empty-editor {
  height: 100% !important;
  min-height: 0 !important;
}

.memo-main-panel .memo-content-input {
  flex: 1 1 auto !important;
  min-height: 260px !important;
}

.memo-todo-panel {
  display: flex !important;
  flex-direction: column !important;
  max-height: none !important;
}

.memo-todo-panel .memo-scroll {
  min-height: 0 !important;
  max-height: none !important;
}

.memo-todo-panel .memo-scroll:not(.compact) {
  flex: 1 1 0 !important;
}

.memo-todo-panel .memo-scroll.compact {
  flex: 0 1 190px !important;
}

@media (max-width: 980px) {
  .memo-main-panel,
  .memo-todo-panel {
    height: auto !important;
    min-height: 0 !important;
  }

  .memo-main-panel .memo-workspace {
    grid-template-columns: 1fr !important;
  }

  .memo-main-panel .memo-list-panel {
    padding-right: 0 !important;
    padding-bottom: 14px !important;
    border-right: 0 !important;
    border-bottom: 1px solid var(--line) !important;
  }

  .memo-main-panel .memo-editor-panel {
    padding-left: 0 !important;
    padding-top: 14px !important;
  }
}

@media (max-width: 1180px) {
  .dashboard-work-layout {
    grid-template-columns: 1fr !important;
  }
}

/* July 11 score/detail polish pass. */
.score-page-actions {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
  gap: 14px !important;
  align-items: stretch !important;
  margin-bottom: 14px !important;
}

.score-page-actions > * {
  min-width: 0 !important;
  margin: 0 !important;
}

.score-table-wrap {
  scrollbar-width: thin !important;
  -ms-overflow-style: auto !important;
}

.score-table-wrap::-webkit-scrollbar:vertical {
  width: 10px !important;
}

.dashboard-quick-section .quick-record-layout {
  align-items: stretch !important;
  flex: 1 1 auto !important;
  min-height: 293px !important;
}

.dashboard-quick-section .quick-record-layout > div:first-child,
.dashboard-quick-section .quick-record-form {
  height: 293px !important;
}

.dashboard-quick-section .quick-record-form {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: stretch !important;
}

.dashboard-quick-section .quick-record-input {
  min-height: 0 !important;
  height: 293px !important;
  max-height: 293px !important;
  resize: none !important;
}

.dashboard-quick-section .quick-record-panel {
  min-height: 0 !important;
  height: 293px !important;
  max-height: 293px !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

.dashboard-quick-section .quick-record-scroll {
  flex: 1 1 auto !important;
  max-height: none !important;
  overflow-y: auto !important;
}

.quick-record-item {
  min-height: 44px !important;
}

.score-table-wrap:has(.detailed-score-table) {
  overflow-x: auto !important;
  overflow-y: auto !important;
  max-height: calc(100vh - 300px) !important;
}

.detailed-score-table thead th {
  top: 0 !important;
  vertical-align: middle !important;
}

.detailed-score-table thead th.score-freeze {
  top: 0 !important;
}

.score-scroll-shell {
  display: block !important;
  width: 100% !important;
  gap: 0 !important;
}

.score-scroll-top,
.score-scroll-bottom {
  width: 100% !important;
}

.score-scroll-arrow {
  display: none !important;
}

.settings-derived-class {
  min-height: 52px !important;
  height: 52px !important;
  border: 1px solid var(--line-strong) !important;
  background: #fff !important;
  border-radius: 8px !important;
  padding: 10px 12px !important;
  display: flex !important;
  align-items: center !important;
  color: var(--text) !important;
  font-size: 15px !important;
  line-height: 1.4 !important;
}

.settings-derived-class-row label {
  color: var(--text) !important;
  font-size: 14px !important;
  font-weight: 500 !important;
}

.settings-derived-class-row .settings-derived-class {
  margin-top: 0 !important;
}

.detail-modal {
  width: min(1280px, calc(100vw - 36px)) !important;
}

.detail-modal .detail-head {
  margin-bottom: 12px !important;
}

.detail-modal .behavior-filter-panel {
  margin-top: 0 !important;
}

.detail-modal .behavior-filter-panel .section-head {
  align-items: start !important;
  gap: 12px !important;
}

.detail-modal .range-controls {
  align-self: start !important;
}

.detail-modal .behavior-layout-with-log {
  align-items: start !important;
}

/* Final dashboard and score-scroll guard: keep only external horizontal score bars. */
.dashboard-info-strip {
  min-height: 42px !important;
  padding: 7px 12px !important;
  display: grid !important;
  grid-template-columns: minmax(220px, auto) minmax(220px, auto) minmax(0, 1fr) !important;
  gap: 10px !important;
  align-items: center !important;
}

.dashboard-info-main {
  display: grid !important;
  gap: 2px !important;
  min-width: 0 !important;
}

.dashboard-info-main strong {
  font-size: 16px !important;
  line-height: 1.25 !important;
}

.dashboard-info-main span {
  color: #476173 !important;
  line-height: 1.2 !important;
  font-size: 13px !important;
}

.dashboard-info-metrics {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, auto)) !important;
  gap: 6px !important;
  align-items: stretch !important;
  min-width: 0 !important;
  justify-content: start !important;
}

.dashboard-info-metric {
  min-width: 0 !important;
  min-height: 34px !important;
  padding: 5px 9px !important;
  border: 1px solid #d5e5ed !important;
  border-radius: 8px !important;
  background: #f8fcff !important;
  display: grid !important;
  grid-template-columns: auto auto !important;
  align-content: center !important;
  align-items: center !important;
  gap: 6px !important;
  color: inherit !important;
  text-decoration: none !important;
}

.dashboard-info-metric span {
  color: #587080 !important;
  font-size: 12px !important;
}

.dashboard-info-metric strong {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  font-size: 15px !important;
  line-height: 1.2 !important;
}

.dashboard-work-layout {
  gap: 14px !important;
  margin-bottom: 14px !important;
}

.dashboard-work-log-panel,
.dashboard-quick-section {
  min-height: 386px !important;
}

.dashboard-quick-section .quick-record-layout {
  align-items: stretch !important;
  min-height: 293px !important;
}

.dashboard-quick-section .quick-record-layout > div:first-child,
.dashboard-quick-section .quick-record-form {
  height: 293px !important;
}

.dashboard-quick-section .quick-record-form {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: stretch !important;
}

.dashboard-quick-section .quick-record-input {
  height: 293px !important;
  min-height: 293px !important;
  max-height: 293px !important;
  resize: none !important;
}

.dashboard-quick-section .quick-record-panel {
  height: 293px !important;
  max-height: 293px !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

.dashboard-quick-section .quick-record-scroll {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow-y: auto !important;
}

.work-log-scroll {
  max-height: 293px !important;
  overflow-y: auto !important;
}

.score-table-wrap:has(.detailed-score-table) {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  max-height: calc(100vh - 300px) !important;
}

.detailed-score-table th.score-freeze-no,
.detailed-score-table td.score-freeze-no {
  text-align: center !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.detailed-score-table .score-stack {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  justify-content: center !important;
  justify-items: stretch !important;
  align-items: center !important;
  gap: 3px 4px !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow: hidden !important;
}

.detailed-score-table .score-cell-line {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  display: inline-flex !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 2px !important;
  overflow: hidden !important;
  text-overflow: clip !important;
  white-space: nowrap !important;
  font-size: 13px !important;
}

.detailed-score-table .score-cell-line b {
  min-width: auto !important;
  flex: 0 0 auto !important;
}

@media (max-width: 980px) {
  .score-page-actions {
    grid-template-columns: 1fr !important;
  }

  .dashboard-info-strip,
  .dashboard-info-metrics {
    grid-template-columns: 1fr !important;
  }

  .dashboard-quick-section .quick-record-form {
    grid-template-columns: 1fr !important;
  }
}

/* Final July 11 score-table and dashboard density guard. Keep this block at EOF. */
.score-scroll-hint,
.score-scroll-shell {
  display: none !important;
}

.score-table-wrap:has(.detailed-score-table) {
  width: 100% !important;
  max-width: none !important;
  overflow: visible !important;
  max-height: none !important;
  scrollbar-width: auto !important;
  scrollbar-color: #167c91 #dcecf2 !important;
}

.score-table-sticky-head {
  position: sticky !important;
  top: 0 !important;
  z-index: 90 !important;
  background: #f4f8fb !important;
}

.score-head-scroll {
  width: 100% !important;
  max-width: 100% !important;
  overflow: hidden !important;
  background: #ffffff !important;
}

.score-body-table thead {
  display: none !important;
}

.score-table-body-scroll {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  overflow-y: visible !important;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

.score-table-body-scroll::-webkit-scrollbar {
  display: none !important;
  height: 0 !important;
}

.score-table-wrap::-webkit-scrollbar:vertical {
  width: 12px !important;
}

.score-native-scroll {
  height: 24px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  background: #eef8fb !important;
  border: 1px solid #7f8a93 !important;
  border-bottom: 0 !important;
  scrollbar-width: auto !important;
  scrollbar-color: #1e88a8 #d8e4ec !important;
}

.score-native-scroll-top {
  position: relative !important;
  top: auto !important;
  left: 0 !important;
  z-index: 90 !important;
}

.score-native-scroll-spacer {
  height: 1px !important;
}

.score-native-scroll::-webkit-scrollbar {
  height: 14px !important;
}

.score-native-scroll::-webkit-scrollbar-track {
  background: #d8e4ec !important;
  border-radius: 999px !important;
}

.score-native-scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, #1e88a8, #156779) !important;
  border: 2px solid #eef8fb !important;
  border-radius: 999px !important;
}

.detailed-score-table {
  width: max-content !important;
  max-width: none !important;
  table-layout: fixed !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

.detailed-score-table .score-col-no { width: 86px !important; min-width: 86px !important; }
.detailed-score-table .score-col-name { width: 88px !important; min-width: 88px !important; }
.detailed-score-table .score-col-subjects { width: 106px !important; min-width: 106px !important; }
.detailed-score-table .score-col-total { width: 150px !important; min-width: 150px !important; }
.detailed-score-table .score-col-rank { width: 118px !important; min-width: 118px !important; }
.detailed-score-table .score-col-subject { width: 166px !important; min-width: 166px !important; }
.detailed-score-table:not(.score-no-raw) .score-col-subject,
.detailed-score-table:not(.score-no-elective) .score-col-subject { width: 192px !important; min-width: 192px !important; max-width: 192px !important; }

.detailed-score-table thead th {
  position: relative !important;
  top: auto !important;
  z-index: 58 !important;
}

.detailed-score-table th,
.detailed-score-table td {
  text-align: center !important;
  vertical-align: middle !important;
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: clip !important;
  padding: 8px 10px !important;
}

.detailed-score-table .score-freeze {
  position: sticky !important;
  background: #fff !important;
  z-index: 30 !important;
}

.detailed-score-table th.score-freeze {
  background: #eef8fb !important;
  z-index: 76 !important;
}

.detailed-score-table .score-freeze-no { left: 0 !important; }
.detailed-score-table .score-freeze-name { left: 86px !important; }
.detailed-score-table .score-freeze-subjects { left: 174px !important; }
.detailed-score-table .score-freeze-total { left: 280px !important; }

.detailed-score-table th.score-freeze-no,
.detailed-score-table td.score-freeze-no {
  text-align: center !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.detailed-score-table .score-freeze-total {
  border-right: 3px solid #5f6972 !important;
  box-shadow: inset -1px 0 0 #7f8a93, inset 0 -1px 0 #7f8a93, 4px 0 0 #5f6972 !important;
}

.detailed-score-table .score-stack {
  display: grid !important;
  grid-template-columns: repeat(2, max-content) !important;
  justify-content: center !important;
  justify-items: center !important;
  align-items: center !important;
  gap: 4px 8px !important;
  width: max-content !important;
  min-width: 100% !important;
  max-width: none !important;
  overflow: visible !important;
}

.detailed-score-table .score-freeze-total .score-stack {
  grid-template-columns: 1fr !important;
  width: 100% !important;
}

.detailed-score-table .score-cell-line,
.detailed-score-table .score-field-value,
.detailed-score-table .score-sort-head,
.detailed-score-table .score-sort-head > div {
  justify-content: center !important;
  justify-items: center !important;
  align-items: center !important;
  text-align: center !important;
  white-space: nowrap !important;
  min-width: max-content !important;
  max-width: none !important;
  overflow: visible !important;
}

.detailed-score-table .score-field-value {
  display: inline-flex !important;
  gap: 2px !important;
}

.dashboard-info-strip {
  min-height: 24px !important;
  padding: 4px 10px !important;
  grid-template-columns: minmax(260px, auto) minmax(220px, auto) minmax(0, 1fr) !important;
  gap: 8px !important;
}

.dashboard-info-main {
  display: flex !important;
  align-items: baseline !important;
  gap: 8px !important;
}

.dashboard-info-main strong {
  font-size: 15px !important;
  line-height: 1.1 !important;
}

.dashboard-info-main span {
  font-size: 12px !important;
  line-height: 1.1 !important;
}

.dashboard-info-metrics {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  min-height: 26px !important;
  padding: 4px 8px !important;
  border: 1px solid #d5e5ed !important;
  border-radius: 8px !important;
  background: #f8fcff !important;
}

.dashboard-info-metric {
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  display: inline-flex !important;
  align-items: baseline !important;
  gap: 4px !important;
}

.dashboard-info-metric.metric-students strong { color: #0f7890 !important; }
.dashboard-info-metric.metric-boarding strong { color: #2f855a !important; }
.dashboard-info-metric.metric-day strong { color: #a15c07 !important; }

.dashboard-work-log-panel,
.dashboard-quick-section {
  min-height: 522px !important;
}

.dashboard-quick-section .quick-record-layout {
  align-items: stretch !important;
  min-height: 411px !important;
}

.dashboard-quick-section .quick-record-layout > div:first-child,
.dashboard-quick-section .quick-record-form {
  height: 411px !important;
}

.dashboard-quick-section .quick-record-input {
  height: 411px !important;
  min-height: 411px !important;
  max-height: 411px !important;
  resize: none !important;
}

.dashboard-quick-section .quick-record-panel {
  height: 411px !important;
  max-height: 411px !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

.dashboard-quick-section .quick-record-scroll {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
}

.work-log-scroll {
  max-height: 411px !important;
  overflow-y: auto !important;
}

/* Leave records: dashboard, student list, and detail modal. */
.dashboard-top-panels {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

.dashboard-leave-panel .dashboard-item-grid {
  max-height: 360px !important;
  overflow-y: auto !important;
  align-content: start !important;
}

.leave-summary-btn {
  display: grid !important;
  gap: 2px !important;
  text-align: left !important;
  line-height: 1.25 !important;
}

.student-table .leave-summary-btn {
  justify-items: center !important;
  text-align: center !important;
  margin: 0 auto !important;
}

.leave-summary-btn small {
  display: block !important;
  color: var(--muted) !important;
  white-space: normal !important;
}

.detail-comm-layout {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px) !important;
  gap: 16px !important;
  align-items: start !important;
}

.detail-leave-panel {
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  padding: 14px !important;
  background: #f8fcfd !important;
}

.leave-record-card {
  width: 100% !important;
  text-align: left !important;
  cursor: pointer !important;
}

.event-log-button {
  width: 100% !important;
  border: 0 !important;
  background: transparent !important;
  text-align: left !important;
  cursor: pointer !important;
}

.leave-detail-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 10px !important;
}

.leave-detail-grid .info-item {
  min-height: 64px !important;
}

@media (max-width: 1180px) {
  .dashboard-top-panels,
  .detail-comm-layout {
    grid-template-columns: 1fr !important;
  }

  .leave-detail-grid {
    grid-template-columns: 1fr !important;
  }
}

/* July 13 leave state and workspace density refinements. */
.dashboard-quick-section #dashboardAiResult {
  display: block !important;
  min-height: 42px !important;
  max-height: 54px !important;
  overflow: hidden !important;
  margin-top: 8px !important;
  text-overflow: ellipsis !important;
}

.memo-top-layout {
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr) !important;
  gap: 16px !important;
}

.memo-main-panel {
  padding: 16px !important;
}

.memo-main-panel .memo-workspace {
  inset: auto !important;
}

.memo-todo-panel {
  padding: 16px !important;
}

.memo-todo-columns {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 12px !important;
  height: 100% !important;
  min-height: 0 !important;
}

.memo-todo-column {
  min-width: 0 !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}

.memo-todo-column .memo-scroll {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
}

.dashboard-reminder-item {
  height: 96px !important;
  min-height: 96px !important;
  max-height: 96px !important;
  overflow: hidden !important;
}

.dashboard-reminder-item .dashboard-card-main {
  min-width: 0 !important;
  overflow: hidden !important;
}

.dashboard-reminder-item strong,
.dashboard-reminder-item .muted {
  display: block !important;
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

@media (max-width: 1180px) {
  .memo-top-layout,
  .memo-todo-columns {
    grid-template-columns: 1fr !important;
  }
}

/* July 13 student leave entry and memo todo alignment refinements. */
.student-table .leave-summary-btn {
  width: 100% !important;
  min-width: 92px !important;
  min-height: 48px !important;
  padding: 4px 8px !important;
  display: grid !important;
  justify-items: center !important;
  align-content: center !important;
  gap: 2px !important;
}

.student-table .leave-summary-idle strong {
  color: var(--green) !important;
}

.memo-todo-panel .todo-item {
  display: grid !important;
  grid-template-columns: 28px minmax(0, 1fr) 52px !important;
  align-items: center !important;
  gap: 10px !important;
  height: 96px !important;
  min-height: 96px !important;
  max-height: 96px !important;
  padding: 10px 12px !important;
}

.todo-row-main {
  min-width: 0 !important;
  height: 78px !important;
  display: grid !important;
  grid-template-rows: 20px 34px 24px !important;
  align-items: start !important;
  gap: 2px !important;
}

.todo-row-title,
.todo-row-meta {
  display: block !important;
  min-width: 0 !important;
  text-align: left !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.todo-row-title {
  white-space: nowrap !important;
  line-height: 20px !important;
}

.todo-row-meta {
  line-height: 17px !important;
  white-space: normal !important;
  display: -webkit-box !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 2 !important;
}

.todo-row-tags {
  height: 24px !important;
  min-height: 24px !important;
  overflow: hidden !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 4px !important;
}

.memo-todo-panel .todo-check {
  align-self: center !important;
  justify-self: center !important;
}

.memo-todo-panel .todo-item > .text-btn.danger {
  width: 52px !important;
  justify-self: end !important;
  text-align: right !important;
  white-space: nowrap !important;
}

/* July 13 overflow fixes for memo cards, quick status, and watch controls. */
.dashboard-quick-section .quick-record-layout {
  min-height: 470px !important;
}

.dashboard-quick-section .quick-record-layout > div:first-child {
  display: grid !important;
  grid-template-rows: minmax(0, 1fr) 42px !important;
  gap: 10px !important;
  height: 454px !important;
  min-height: 454px !important;
  max-height: 454px !important;
}

.dashboard-quick-section .quick-record-form {
  height: auto !important;
  min-height: 0 !important;
}

.dashboard-quick-section .quick-record-input {
  height: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
}

.dashboard-quick-section #dashboardAiResult {
  align-self: end !important;
  min-height: 42px !important;
  max-height: 42px !important;
  margin-top: 0 !important;
  margin-bottom: 12px !important;
  padding: 8px 12px !important;
  line-height: 20px !important;
}

.dashboard-quick-section .quick-record-panel {
  height: 454px !important;
  max-height: 454px !important;
}

.memo-todo-panel .todo-item {
  height: 112px !important;
  min-height: 112px !important;
  max-height: 112px !important;
  padding: 12px 12px !important;
}

.todo-row-main {
  height: 78px !important;
  grid-template-rows: 20px 32px 22px !important;
  gap: 2px !important;
  overflow: hidden !important;
}

.todo-row-meta {
  line-height: 16px !important;
}

.todo-row-tags {
  height: 22px !important;
  min-height: 22px !important;
  align-content: center !important;
}

.todo-row-tags .tag,
.todo-row-tags .text-btn {
  max-height: 22px !important;
  line-height: 18px !important;
}

.dashboard-watch-controls label {
  display: grid !important;
  grid-template-columns: 1fr !important;
  align-items: center !important;
}

.dashboard-watch-controls label > span {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  flex-wrap: wrap !important;
}

.dashboard-watch-inline-stepper {
  display: inline-grid !important;
  grid-template-columns: 20px 28px 20px !important;
  align-items: center !important;
  justify-items: center !important;
  gap: 2px !important;
  vertical-align: middle !important;
}

.dashboard-watch-inline-stepper button {
  width: 20px !important;
  height: 24px !important;
  padding: 0 !important;
  border: 1px solid var(--line-strong) !important;
  border-radius: 6px !important;
  background: #fff !important;
  color: var(--primary-dark) !important;
  line-height: 1 !important;
}

.dashboard-watch-inline-stepper strong {
  width: 28px !important;
  text-align: center !important;
  font-size: 14px !important;
  line-height: 24px !important;
}

/* July 13 final alignment pass: native watch inputs, visible todo tags, and quick status breathing room. */
.dashboard-quick-section .quick-record-layout {
  min-height: 492px !important;
}

.dashboard-quick-section .quick-record-layout > div:first-child {
  grid-template-rows: minmax(0, 1fr) 44px !important;
  gap: 18px !important;
  height: 472px !important;
  min-height: 472px !important;
  max-height: 472px !important;
}

.dashboard-quick-section #dashboardAiResult {
  align-self: stretch !important;
  min-height: 44px !important;
  max-height: 44px !important;
  margin: 0 0 12px 0 !important;
  padding: 9px 12px !important;
  overflow: hidden !important;
}

.dashboard-quick-section .quick-record-panel {
  height: 472px !important;
  max-height: 472px !important;
}

.memo-todo-panel .todo-item {
  height: 128px !important;
  min-height: 128px !important;
  max-height: 128px !important;
  padding: 12px 14px !important;
  align-items: center !important;
}

.todo-row-main {
  height: 104px !important;
  grid-template-rows: 22px 40px 28px !important;
  gap: 4px !important;
  overflow: hidden !important;
}

.todo-row-title,
.todo-row-meta {
  min-width: 0 !important;
}

.todo-row-meta {
  line-height: 20px !important;
  max-height: 40px !important;
}

.todo-row-tags {
  height: 28px !important;
  min-height: 28px !important;
  max-height: 28px !important;
  display: flex !important;
  align-items: center !important;
  align-content: center !important;
  gap: 6px !important;
  overflow: hidden !important;
  flex-wrap: nowrap !important;
}

.todo-row-tags .tag,
.todo-row-tags .text-btn {
  height: 22px !important;
  max-height: 22px !important;
  line-height: 18px !important;
  display: inline-flex !important;
  align-items: center !important;
  white-space: nowrap !important;
}

.dashboard-watch-controls label > span {
  gap: 5px !important;
  flex-wrap: nowrap !important;
}

.dashboard-watch-number {
  display: inline-flex !important;
  align-items: center !important;
  gap: 2px !important;
  white-space: nowrap !important;
}

.dashboard-watch-number input {
  width: 52px !important;
  height: 30px !important;
  min-height: 30px !important;
  padding: 0 2px 0 7px !important;
  border: 1px solid var(--line-strong) !important;
  border-radius: 7px !important;
  background: #fff !important;
  color: var(--text) !important;
  font-size: 14px !important;
  line-height: 30px !important;
}

/* July 13 memo todo headers: keep both columns on the same horizontal rhythm. */
.memo-todo-column .section-head {
  height: 54px !important;
  min-height: 54px !important;
  max-height: 54px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  margin: 0 0 14px 0 !important;
  padding: 0 !important;
}

.memo-todo-column .section-head h2 {
  margin: 0 !important;
  line-height: 40px !important;
}

.memo-todo-column .section-head .ghost-btn {
  height: 44px !important;
  min-height: 44px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  white-space: nowrap !important;
}

.memo-todo-column .memo-scroll {
  margin-top: 0 !important;
}

/* July 13 density pass: more content, less empty air. */
.memo-todo-panel .todo-item {
  height: 104px !important;
  min-height: 104px !important;
  max-height: 104px !important;
  padding: 10px 12px !important;
}

.todo-row-main {
  height: 80px !important;
  grid-template-rows: 20px 32px 24px !important;
  gap: 2px !important;
}

.todo-row-meta {
  max-height: 32px !important;
  line-height: 16px !important;
}

.todo-row-tags {
  height: 24px !important;
  min-height: 24px !important;
  max-height: 24px !important;
}

.dashboard-work-log-panel {
  display: flex !important;
  flex-direction: column !important;
}

.dashboard-work-log-panel .section-head {
  flex: 0 0 auto !important;
}

.work-log-scroll {
  flex: 1 1 auto !important;
  max-height: none !important;
  min-height: 0 !important;
  padding-bottom: 0 !important;
}

.work-log-item {
  min-height: 52px !important;
  padding: 8px 10px !important;
}

.work-log-main small {
  margin-top: 1px !important;
}

.leave-detail-modal {
  max-width: 720px !important;
  max-height: none !important;
  overflow: visible !important;
  padding: 18px !important;
}

.leave-detail-modal .modal-head {
  margin-bottom: 10px !important;
}

.leave-detail-modal .form-grid {
  gap: 8px !important;
}

.leave-detail-modal .form-row {
  gap: 4px !important;
}

.leave-detail-modal input,
.leave-detail-modal select {
  min-height: 40px !important;
  height: 40px !important;
  padding: 8px 10px !important;
}

.leave-detail-modal textarea {
  min-height: 54px !important;
  height: 54px !important;
  max-height: 54px !important;
  padding: 8px 10px !important;
  resize: none !important;
}

.leave-detail-modal .modal-actions {
  margin-top: 10px !important;
}

.quick-leave-batch-backdrop {
  align-items: flex-start !important;
  overflow-y: auto !important;
  padding: 24px !important;
}

.quick-leave-batch-modal {
  width: min(1440px, calc(100vw - 48px)) !important;
  max-height: none !important;
  overflow: visible !important;
}

.quick-leave-batch-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  align-items: start;
}

.leave-detail-card-shell {
  flex: 0 0 min(440px, 100%);
  max-width: 440px;
  min-width: 0;
}

.leave-detail-card-shell .leave-detail-modal {
  width: 100% !important;
  max-width: none !important;
  box-shadow: none !important;
}

.memo-main-head {
  margin-bottom: 8px !important;
}

.memo-editor-form {
  gap: 8px !important;
}

.memo-editor-toolbar {
  justify-content: flex-end !important;
  min-height: 24px !important;
}

.memo-editor-meta-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
  min-width: 0 !important;
}

.memo-editor-time {
  margin: 0 !important;
  min-width: 0 !important;
}

.memo-pin-control {
  flex: 0 0 auto !important;
  padding: 5px 9px !important;
}

.memo-title-input {
  padding: 6px 2px 8px !important;
  font-size: 22px !important;
}

.memo-main-panel .memo-content-input {
  min-height: 340px !important;
}

.dashboard-info-metric.metric-leave strong {
  color: #c2410c !important;
}

/* July 13 emergency fix: restore dashboard render and keep compact todo cards readable. */
.memo-todo-panel .todo-item {
  height: 116px !important;
  min-height: 116px !important;
  max-height: 116px !important;
  padding: 8px 12px !important;
  align-items: center !important;
  overflow: hidden !important;
}

.todo-row-main {
  height: 92px !important;
  grid-template-rows: 22px 36px 26px !important;
  gap: 4px !important;
  overflow: hidden !important;
}

.todo-row-title {
  line-height: 22px !important;
  max-height: 22px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.todo-row-meta {
  max-height: 36px !important;
  line-height: 18px !important;
  overflow: hidden !important;
}

.todo-row-tags {
  height: 26px !important;
  min-height: 26px !important;
  max-height: 26px !important;
  align-items: center !important;
  overflow: hidden !important;
}

.todo-row-tags .tag,
.todo-row-tags .text-btn {
  height: 22px !important;
  min-height: 22px !important;
  max-height: 22px !important;
  line-height: 18px !important;
}

.memo-editor-meta-row .memo-auto-save-status {
  flex: 0 0 auto !important;
  margin-left: auto !important;
}

/* July 13 dashboard and todo final density correction. */
.dashboard-work-log-panel {
  align-self: stretch !important;
}

.work-log-scroll {
  flex: 0 0 472px !important;
  height: 472px !important;
  max-height: 472px !important;
  min-height: 0 !important;
  overflow-y: auto !important;
}

.memo-todo-panel .todo-item {
  height: 104px !important;
  min-height: 104px !important;
  max-height: 104px !important;
  padding: 8px 12px !important;
  grid-template-columns: 24px minmax(0, 1fr) 44px !important;
  gap: 8px !important;
}

.todo-row-main {
  height: 78px !important;
  grid-template-rows: 20px 28px 24px !important;
  gap: 3px !important;
}

.todo-row-title {
  line-height: 20px !important;
  max-height: 20px !important;
}

.todo-row-meta {
  line-height: 14px !important;
  max-height: 28px !important;
}

.todo-row-tags {
  height: 24px !important;
  min-height: 24px !important;
  max-height: 24px !important;
  align-items: start !important;
  padding-top: 1px !important;
}

.todo-row-tags .tag,
.todo-row-tags .text-btn {
  height: 20px !important;
  min-height: 20px !important;
  max-height: 20px !important;
  line-height: 16px !important;
  padding-top: 1px !important;
  padding-bottom: 1px !important;
}

.memo-todo-panel .todo-check {
  width: 18px !important;
  justify-self: center !important;
}

.memo-todo-panel .todo-item > .text-btn.danger {
  width: 44px !important;
}

.dashboard-watch-item .dashboard-card-main {
  display: block !important;
}

.dashboard-watch-item .student-card-head {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 48px !important;
  gap: 8px !important;
  align-items: center !important;
}

.dashboard-watch-item .student-card-head > div {
  min-width: 0 !important;
}

.dashboard-watch-item .student-card-head .tag {
  width: 44px !important;
  min-width: 44px !important;
  height: 46px !important;
  min-height: 46px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  white-space: nowrap !important;
  overflow: visible !important;
}

.dashboard-watch-line {
  display: grid !important;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr) !important;
  gap: 4px !important;
  max-width: 100% !important;
}

.dashboard-watch-line span:first-child,
.dashboard-watch-line span:last-child {
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

/* July 13 real EOF readability correction: keep this block last. */
.work-log-item {
  min-height: 88px !important;
  height: 88px !important;
  max-height: 88px !important;
  padding: 10px !important;
  overflow: hidden !important;
}

.work-log-main > div {
  min-width: 0 !important;
}

.work-log-main strong {
  line-height: 20px !important;
  max-height: 20px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.work-log-main .muted {
  line-height: 18px !important;
  max-height: 36px !important;
  white-space: normal !important;
  display: -webkit-box !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 2 !important;
}

.work-log-main small {
  line-height: 18px !important;
  margin-top: 2px !important;
}

.memo-todo-panel .todo-item {
  height: 120px !important;
  min-height: 120px !important;
  max-height: 120px !important;
  padding: 10px 12px !important;
  grid-template-columns: 24px minmax(0, 1fr) 44px !important;
  gap: 8px !important;
  align-items: center !important;
  overflow: hidden !important;
}

.memo-todo-panel .todo-item > div {
  overflow: visible !important;
}

.todo-row-main {
  height: 96px !important;
  grid-template-rows: 22px 36px 26px !important;
  gap: 5px !important;
  overflow: visible !important;
}

.memo-todo-panel .todo-row-title,
.memo-todo-panel .todo-row-meta {
  display: block !important;
  -webkit-line-clamp: unset !important;
  -webkit-box-orient: initial !important;
}

.todo-row-title {
  line-height: 22px !important;
  max-height: 22px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.todo-row-meta {
  line-height: 18px !important;
  max-height: 36px !important;
  overflow: hidden !important;
}

.todo-row-tags {
  height: 26px !important;
  min-height: 26px !important;
  max-height: 26px !important;
  align-items: center !important;
  padding-top: 0 !important;
  overflow: visible !important;
}

.todo-row-tags .tag,
.todo-row-tags .text-btn {
  height: 22px !important;
  min-height: 22px !important;
  max-height: 22px !important;
  line-height: 18px !important;
  padding-top: 2px !important;
  padding-bottom: 2px !important;
  overflow: visible !important;
}

/* July 14 batch selection and leave-state polish. */
.student-table .select-col {
  width: 44px !important;
  min-width: 44px !important;
  text-align: center !important;
  vertical-align: middle !important;
}

.student-table .select-col input {
  width: 16px !important;
  height: 16px !important;
}

.table-check-all {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  height: 44px !important;
  padding: 0 12px !important;
  border: 1px solid var(--line-strong) !important;
  border-radius: 6px !important;
  background: #fff !important;
  white-space: nowrap !important;
}

.table-check-all input {
  width: 16px !important;
  height: 16px !important;
}

.student-table .leave-summary-active strong,
.student-table .leave-summary-sick strong {
  color: #c81e1e !important;
}

body.modal-open {
  overflow: hidden !important;
}

.student-editor-modal {
  width: min(1120px, calc(100vw - 48px)) !important;
  max-width: min(1120px, calc(100vw - 48px)) !important;
  max-height: calc(100vh - 48px) !important;
}

.student-editor-modal .form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

.student-action-bar.drag-over,
.memo-attachment-drop.drag-over {
  outline: 2px dashed #0b8fa4 !important;
  outline-offset: 3px !important;
  background: #eef9fb !important;
}

.memo-title-row {
  grid-template-columns: minmax(220px, 1fr) auto minmax(180px, 1.2fr) !important;
}

/* July 15 todo completion flow and communication draft attachments. */
.memo-todo-single {
  min-height: 0 !important;
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
}

.memo-todo-toolbar {
  align-items: center !important;
  gap: 10px !important;
}

.memo-todo-toolbar .compact-toolbar {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 8px !important;
  min-width: 0 !important;
}

.memo-todo-toolbar select {
  width: auto !important;
  min-width: 132px !important;
  max-width: 180px !important;
  height: 36px !important;
  padding: 6px 28px 6px 10px !important;
  font-size: 14px !important;
}

.memo-todo-panel .compact-todo-item {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 8px !important;
  min-height: 52px !important;
  padding: 7px 9px !important;
}

.memo-todo-panel .memo-todo-column {
  height: 100% !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}

.memo-todo-panel .memo-scroll.compact {
  flex: 1 1 auto !important;
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  align-content: start !important;
  gap: 8px !important;
  min-height: 480px !important;
  max-height: none !important;
  overflow-y: auto !important;
  padding: 6px 6px 10px 0 !important;
}

.todo-row-main {
  min-width: 0 !important;
}

.todo-row-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 6px !important;
  white-space: nowrap !important;
}

.compact-todo-item .todo-row-title,
.compact-todo-item .todo-row-meta {
  display: block !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.compact-todo-item .todo-row-tags {
  margin-top: 4px !important;
  gap: 5px !important;
}

.compact-todo-item .tag,
.compact-todo-item .compact-btn,
.compact-todo-item .text-btn {
  font-size: 12px !important;
  padding: 4px 7px !important;
  min-height: 28px !important;
}

.compact-todo-item.completed {
  background: #f8fbfc !important;
}

.completed-todo-modal {
  width: min(860px, 92vw) !important;
  max-height: min(760px, 88vh) !important;
}

.completed-todo-actions {
  margin: 2px 0 10px !important;
  gap: 12px !important;
}

.completed-todo-list {
  max-height: min(520px, 58vh) !important;
  overflow: auto !important;
  padding-right: 4px !important;
}

.completed-selection-item {
  display: grid !important;
  grid-template-columns: 28px minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 10px !important;
  min-height: 88px !important;
  cursor: default !important;
}

.completed-selection-item .todo-row-main {
  min-width: 0 !important;
}

.completed-todo-check,
.completed-select-all {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
}

.completed-todo-check input,
.completed-select-all input {
  width: 16px !important;
  height: 16px !important;
}

.communication-edit-modal {
  width: min(760px, 92vw) !important;
}

.communication-draft-attachment-box {
  display: grid !important;
  gap: 8px !important;
  margin-top: 10px !important;
  padding: 10px !important;
  border: 1px solid var(--line) !important;
  border-radius: 6px !important;
  background: #f8fcfd !important;
}

.communication-draft-attachment-box .compact-head {
  margin: 0 !important;
}

.communication-draft-attachment-box .compact-drop {
  min-height: 74px !important;
  padding: 12px !important;
}

.communication-draft-attachment-list {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  min-height: 28px !important;
  align-items: center !important;
}

.communication-draft-attachment-list .memo-attachment-chip {
  max-width: 220px !important;
}

@media (max-width: 760px) {
  .memo-todo-toolbar {
    grid-template-columns: 1fr !important;
  }

  .memo-todo-panel .memo-scroll.compact {
    grid-template-columns: 1fr !important;
  }

  .todo-row-actions,
  .memo-todo-toolbar .compact-toolbar {
    justify-content: flex-start !important;
  }
}

.memo-attachment-upload-modal {
  width: min(560px, calc(100vw - 40px)) !important;
}

.memo-attachment-modal-drop {
  min-height: 220px !important;
  border: 1px dashed #b8d6e3 !important;
  border-radius: 8px !important;
  background: #f8fcfd !important;
  display: grid !important;
  place-items: center !important;
  align-content: center !important;
  gap: 12px !important;
  padding: 24px !important;
  text-align: center !important;
}

.memo-attachment-modal-drop.drag-over {
  outline: 2px dashed #0b8fa4 !important;
  outline-offset: 3px !important;
  background: #eef9fb !important;
}

.memo-attachment-slot {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  overflow-x: auto !important;
  min-height: 36px !important;
}

.memo-attachment-chip {
  border: 1px solid var(--line) !important;
  background: #eef9fb !important;
  color: #0f5870 !important;
  border-radius: 999px !important;
  padding: 5px 10px !important;
  max-width: 160px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  flex: 0 0 auto !important;
}

.memo-attachment-select {
  min-width: 240px !important;
  max-width: 360px !important;
  height: 34px !important;
  border: 1px solid var(--line) !important;
  border-radius: 6px !important;
  background: #fff !important;
  padding: 0 34px 0 10px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.memo-attachment-drop {
  border: 1px dashed #b8d6e3 !important;
  border-radius: 6px !important;
  color: #496479 !important;
  background: #f8fcfd !important;
  padding: 8px 10px !important;
  font-size: 14px !important;
}

.memo-attachment-drop[hidden] {
  display: none !important;
}

.student-import-drop {
  margin: 10px 0 12px !important;
  border: 1px dashed #b8d6e3 !important;
  border-radius: 6px !important;
  background: #f8fcfd !important;
  color: #496479 !important;
  padding: 10px 12px !important;
  font-size: 14px !important;
}

.student-import-drop.drag-over {
  outline: 2px dashed #0b8fa4 !important;
  outline-offset: 3px !important;
  background: #eef9fb !important;
}

.student-import-modal {
  width: min(560px, calc(100vw - 40px)) !important;
}

.student-import-modal-drop {
  min-height: 220px !important;
  border: 1px dashed #b8d6e3 !important;
  border-radius: 8px !important;
  background: #f8fcfd !important;
  display: grid !important;
  place-items: center !important;
  align-content: center !important;
  gap: 12px !important;
  padding: 24px !important;
  text-align: center !important;
}

.student-import-modal-drop.drag-over {
  outline: 2px dashed #0b8fa4 !important;
  outline-offset: 3px !important;
  background: #eef9fb !important;
}

.attachment-manager-panel {
  margin-top: 16px !important;
  border-top: 1px solid var(--line) !important;
  padding-top: 14px !important;
}

.attachment-manager-list {
  display: grid !important;
  gap: 8px !important;
  margin-top: 10px !important;
  max-height: 260px !important;
  overflow-y: auto !important;
}

.attachment-manager-toolbar {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 12px !important;
  margin-top: 8px !important;
}

.attachment-manager-head {
  align-items: center !important;
  gap: 16px !important;
}

.attachment-manager-filters,
.attachment-manager-actions {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
}

.attachment-manager-filters {
  margin-left: auto !important;
  flex-wrap: nowrap !important;
}

.attachment-manager-filters select {
  min-width: 126px !important;
}

.attachment-manager-filters input[type="date"] {
  min-width: 138px !important;
  height: 38px !important;
}

.attachment-manager-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)) !important;
  align-content: start !important;
  gap: 8px !important;
  max-height: 360px !important;
  overflow-y: auto !important;
  margin-top: 8px !important;
  padding-right: 4px !important;
}

.attachment-manager-file {
  position: relative !important;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  background: #f8fcfd !important;
  min-height: 74px !important;
  min-width: 0 !important;
  overflow: hidden !important;
}

.attachment-file-check {
  position: absolute !important;
  left: 8px !important;
  top: 8px !important;
  z-index: 1 !important;
}

.attachment-file-main {
  width: 100% !important;
  height: 100% !important;
  min-height: 74px !important;
  border: 0 !important;
  background: transparent !important;
  display: grid !important;
  gap: 2px !important;
  justify-items: start !important;
  align-content: center !important;
  padding: 8px 8px 8px 30px !important;
  cursor: pointer !important;
  color: var(--text) !important;
  text-align: left !important;
  min-width: 0 !important;
}

.attachment-file-main strong,
.attachment-file-main small {
  max-width: 100% !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.attachment-file-main strong {
  font-size: 13px !important;
}

.attachment-file-main small {
  font-size: 12px !important;
  line-height: 1.25 !important;
}

.attachment-manager-item,
.archived-memo-item {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 12px !important;
}

.attachment-manager-actions,
.archived-memo-actions {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  white-space: nowrap !important;
}

.detail-tab-bar {
  border-bottom: 1px solid var(--line) !important;
  gap: 8px !important;
}

.detail-section-head {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
}

.detail-action-btn {
  min-height: 34px !important;
  border-radius: 6px !important;
  padding: 7px 12px !important;
}

@media (max-width: 900px) {
  .student-editor-modal .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 640px) {
  .student-editor-modal .form-grid,
  .attachment-manager-item,
  .archived-memo-item {
    grid-template-columns: 1fr !important;
  }
}

/* July 14 memo archive and attachment controls. */
.memo-main-head .compact-toolbar {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
}

.memo-subhead {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
  padding-right: 8px !important;
}

.memo-select-all {
  font-size: 14px !important;
  white-space: nowrap !important;
  min-height: 44px !important;
  border: 1px solid var(--line-strong) !important;
  flex: 0 0 auto !important;
}

.memo-list-actions {
  display: flex !important;
  justify-content: flex-end !important;
  gap: 8px !important;
  padding: 0 8px 8px !important;
}

.memo-list-actions button {
  min-height: 34px !important;
  padding: 6px 12px !important;
}

.memo-list-item {
  grid-template-columns: minmax(0, 1fr) 28px !important;
  align-items: center !important;
  gap: 8px !important;
  height: 96px !important;
  min-height: 96px !important;
  max-height: 96px !important;
  overflow: hidden !important;
}

.memo-list-main {
  min-width: 0 !important;
  overflow: hidden !important;
}

.memo-list-main span,
.memo-list-main small {
  display: block !important;
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.memo-list-main small:last-child {
  text-overflow: ellipsis !important;
}

.memo-row-check {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 28px !important;
  height: 36px !important;
}

.memo-row-check input {
  width: 16px !important;
  height: 16px !important;
}

.memo-title-row {
  display: grid !important;
  grid-template-columns: minmax(220px, 1fr) auto minmax(120px, 1fr) !important;
  align-items: center !important;
  gap: 10px !important;
}

.memo-title-row .memo-title-input {
  width: 100% !important;
  max-width: none !important;
}

.memo-attachment-slot {
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.archived-memos-panel {
  margin-top: 18px !important;
  padding-top: 16px !important;
  border-top: 1px solid var(--line) !important;
}

.archived-memo-list {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  align-content: start !important;
  gap: 10px !important;
}

.archived-memo-item {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 10px !important;
  border: 1px solid var(--line) !important;
  border-radius: 6px !important;
  background: #f8fcfd !important;
  min-width: 0 !important;
}

.archived-memo-item strong,
.archived-memo-item .muted {
  display: block !important;
  max-width: 100% !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

@media (max-width: 760px) {
  .memo-title-row,
  .archived-memo-item {
    grid-template-columns: 1fr !important;
  }
}

.memo-title-row {
  grid-template-columns: minmax(220px, 1fr) auto minmax(180px, 1.2fr) !important;
}

/* July 15 settings attachment manager and markdown transfer layout. */
.settings-layout {
  display: grid;
  grid-template-columns: minmax(420px, 0.92fr) minmax(520px, 1.08fr);
  gap: 16px;
  align-items: stretch;
}
.settings-left-panel,
.settings-right-stack {
  min-height: calc(100vh - 120px);
}
.settings-left-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.settings-transfer-panel {
  margin-top: auto;
  border: 1px solid #cfe3ef;
  border-radius: 8px;
  padding: 14px;
  background: #f8fcfe;
}
.settings-transfer-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin: 10px 0;
}
.settings-transfer-actions button {
  min-height: 38px;
}
.settings-backup-block {
  display: grid;
  gap: 10px;
}
.settings-transfer-divider {
  height: 1px;
  margin: 16px 0;
  background: #cfe3ef;
}
.account-backup-preview {
  padding: 12px;
  border: 1px solid #bfd9e7;
  border-radius: 6px;
  background: #fff;
}
.account-backup-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.account-backup-preview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.account-backup-preview-grid span {
  min-width: 0;
  color: #527087;
  font-size: 13px;
}
.account-backup-preview-grid strong {
  display: block;
  margin-top: 3px;
  color: #10243d;
  overflow-wrap: anywhere;
}
.danger-text {
  color: #c52f20;
}
@media (max-width: 760px) {
  .account-backup-preview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .account-backup-preview-head {
    align-items: flex-start;
    flex-direction: column;
  }
}
.settings-right-stack {
  display: grid;
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}
.settings-half-panel {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.settings-half-panel .archived-memo-list,
.settings-half-panel .attachment-manager-grid {
  min-height: 0;
  overflow-y: auto;
}
.settings-attachment-panel {
  padding: 16px;
}
.settings-attachment-storage {
  flex: 0 0 auto;
  margin: 0 0 14px;
}
.settings-attachment-panel .attachment-manager-panel {
  border: 0;
  height: auto;
  min-height: 0;
  flex: 1;
  margin: 0;
  display: flex;
  flex-direction: column;
}
.settings-attachment-panel .attachment-manager-grid {
  flex: 1;
}
.attachment-file-main small:last-child {
  color: #0f7890;
  font-weight: 700;
}
.todo-edit-modal {
  width: min(980px, calc(100vw - 48px)) !important;
  max-height: calc(100vh - 48px) !important;
}
.todo-edit-modal .todo-editor-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 12px !important;
}
.todo-edit-modal .todo-editor-title,
.todo-edit-modal .todo-editor-date {
  min-width: 0 !important;
}
.todo-edit-modal textarea {
  min-height: 210px !important;
}
@media (max-width: 1100px) {
  .settings-layout {
    grid-template-columns: 1fr;
  }
  .settings-left-panel,
  .settings-right-stack {
    min-height: auto;
  }
  .settings-right-stack {
    grid-template-rows: auto auto;
  }
  .todo-edit-modal .todo-editor-grid,
  .archived-memo-list {
    grid-template-columns: 1fr !important;
  }
}

/* July 15 generic forms page. */
.generic-forms-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.generic-form-sidebar,
.generic-form-main {
  min-width: 0;
}
.generic-form-list {
  display: grid;
  gap: 8px;
}
.generic-form-tab {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fcfe;
  padding: 10px;
  color: var(--ink);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.generic-form-tab-main {
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 0;
  min-width: 0;
  cursor: pointer;
}
.generic-form-tab-main strong,
.generic-form-tab-main span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.generic-form-tab-main span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}
.generic-form-tab-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.generic-form-tab-actions .text-btn {
  white-space: nowrap;
  padding: 3px 4px;
}
.generic-form-tab.active {
  border-color: var(--brand);
  background: #eefbff;
  box-shadow: inset 3px 0 0 var(--brand);
}
.generic-form-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.generic-form-title-input {
  flex: 1 1 260px;
  min-width: 220px;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0 10px;
  font: inherit;
  font-weight: 700;
}
.generic-sheet-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: white;
  max-height: none;
}
.generic-sheet {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.generic-sheet th,
.generic-sheet td {
  border: 1px solid #b9cad6;
  padding: 6px;
  min-width: 150px;
  vertical-align: middle;
  background: white;
}
.generic-sheet thead th {
  position: sticky;
  top: 0;
  z-index: 6;
  background: #eaf7fb;
  background-clip: padding-box;
  box-shadow: 0 -1px 0 #b9cad6, 0 1px 0 #b9cad6;
}
.generic-sheet .generic-filter-row th {
  top: var(--generic-head-height, 64px);
  z-index: 5;
  background: #f7fbfd;
  background-clip: padding-box;
  box-shadow: 0 -1px 0 #b9cad6, 0 1px 0 #b9cad6;
}
.generic-column-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.generic-column-head input,
.generic-filter-row input,
.generic-filter-row select,
.generic-cell-input,
.generic-cell-choice {
  width: 100%;
  min-width: 0;
  height: 34px;
  border: 1px solid #c9dbe6;
  border-radius: 6px;
  padding: 0 8px;
  font: inherit;
  background: #fff;
}
.generic-cell-editor {
  position: relative;
  display: block;
}
textarea.generic-cell-input {
  display: block;
  min-height: 34px;
  height: auto;
  line-height: 1.35;
  padding-top: 7px;
  padding-bottom: 7px;
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
  padding-right: 30px;
}
.generic-cell-editor.name-cell textarea.generic-cell-input {
  padding-right: 8px;
}
.generic-cell-choice {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 24px;
  height: 26px;
  padding: 0;
  border-radius: 5px;
  font-size: 11px;
  color: var(--muted);
  background: #f8fcfe;
  cursor: pointer;
}
.generic-cell-choice option {
  color: var(--ink);
}
.generic-cell-choice[hidden] {
  display: none;
}
.generic-filter-row input {
  height: 30px;
  font-size: 13px;
}
.generic-filter-row select {
  height: 30px;
  font-size: 13px;
  background: white;
}
.generic-row-actions-head,
.generic-row-actions-cell,
.generic-row-actions-summary {
  position: sticky !important;
  left: 0;
  min-width: 46px !important;
  width: 46px !important;
  max-width: 46px !important;
  padding: 4px 3px !important;
  text-align: center;
  white-space: nowrap;
  background: #f8fcfe !important;
  box-shadow: 1px 0 0 #8bb8c9;
}
.generic-row-actions-head {
  z-index: 10 !important;
}
.generic-filter-row .generic-row-actions-head {
  top: var(--generic-head-height, 64px);
  z-index: 9 !important;
}
.generic-row-actions-cell {
  z-index: 6 !important;
}
.generic-row-actions-summary {
  bottom: 0;
  z-index: 11 !important;
}
.generic-row-inline-actions {
  display: flex;
  gap: 4px;
  justify-content: center;
  align-items: center;
  padding: 0;
  background: transparent;
}
.generic-cell-editor:has(.generic-row-inline-actions) textarea.generic-cell-input {
  padding-right: 8px;
}
.generic-freeze-label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.generic-freeze-label input {
  width: 13px;
  height: 13px;
}
.generic-sticky-col {
  position: sticky !important;
  left: var(--sticky-left);
  z-index: 5;
  box-shadow: 1px 0 0 #8bb8c9;
}
.generic-sticky-head {
  z-index: 8 !important;
}
.generic-sticky-filter {
  z-index: 7 !important;
}
.generic-sticky-summary {
  z-index: 8 !important;
}
.generic-selected-column {
  outline: 2px solid rgba(30, 136, 168, 0.28);
  outline-offset: -2px;
}

/* July 16 memo header density: remove redundant labels and give list/editor more room. */
.memo-main-panel {
  padding-top: 14px !important;
}

.memo-main-head {
  align-items: center !important;
  margin-bottom: 6px !important;
}

.memo-main-toolbar {
  align-items: center !important;
  gap: 10px !important;
  min-width: 0 !important;
}

.memo-header-meta {
  display: inline-flex !important;
  align-items: center !important;
  gap: 10px !important;
  flex-wrap: wrap !important;
  min-width: 0 !important;
  font-size: 13px !important;
  line-height: 1.2 !important;
}

.memo-header-meta .memo-pin-control {
  margin-left: 0 !important;
  padding: 5px 9px !important;
  white-space: nowrap !important;
}

.memo-main-head h2 {
  margin: 0 !important;
}

.memo-list-actions.memo-list-actions-inline {
  justify-content: flex-start !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 0 0 8px !important;
}

.memo-list-actions-inline .memo-select-all {
  min-height: 34px !important;
  height: 34px !important;
  padding: 6px 12px !important;
}

.memo-editor-form {
  gap: 8px !important;
}

.memo-editor-meta-row {
  display: none !important;
}

.memo-editor-time {
  display: flex !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
}

.memo-editor-time .memo-pin-control {
  margin-left: 4px !important;
}

.memo-auto-save-status {
  display: none !important;
}

.transaction-center-head {
  margin-bottom: 12px !important;
}

.transaction-tabs {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 12px !important;
}

.transaction-tab {
  display: grid !important;
  gap: 4px !important;
  min-height: 62px !important;
  padding: 12px 14px !important;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  background: #fff !important;
  color: var(--text) !important;
  text-decoration: none !important;
}

.transaction-tab strong {
  font-size: 17px !important;
  line-height: 1.25 !important;
}

.transaction-tab span {
  color: var(--muted) !important;
  font-size: 13px !important;
  line-height: 1.35 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.transaction-tab.active {
  border-color: var(--primary) !important;
  background: #eef9fb !important;
  box-shadow: inset 0 3px 0 var(--primary) !important;
}

.transaction-tab-body > .section:first-child,
.transaction-tab-body > .grid:first-child {
  margin-top: 0 !important;
}

@media (max-width: 720px) {
  .transaction-tabs {
    grid-template-columns: 1fr !important;
  }

  .transaction-tab span {
    white-space: normal !important;
  }
}

.icon-mini-btn {
  width: 16px;
  height: 20px;
  border-radius: 0;
  border: 0;
  background: transparent !important;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-mini-btn.add {
  color: #15935f;
}
.icon-mini-btn.remove {
  color: #c0392b;
}

.generic-summary-row td {
  position: sticky;
  bottom: 0;
  z-index: 4;
  background: #f8fcfe;
  box-shadow: 0 -1px 0 #8bb8c9, 0 -8px 18px rgba(235, 244, 248, 0.75);
  text-align: center;
  vertical-align: middle;
}
.generic-summary-cell {
  min-height: 40px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  font-size: 13px;
  line-height: 1.3;
  color: var(--muted);
  word-break: break-word;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}
.generic-summary-cell.empty,
.generic-summary-cell.action-spacer {
  border-color: transparent;
  background: transparent;
}
.generic-summary-controls {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  white-space: nowrap;
}
.generic-summary-cell b {
  color: var(--ink);
  font-weight: 700;
}
.generic-summary-item,
.generic-summary-blank {
  display: inline-block;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 700;
}
.generic-summary-lines {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  justify-content: center;
  text-align: center;
  width: 100%;
}
.generic-summary-blank {
  flex-basis: 100%;
}
.generic-summary-stat-toggle {
  align-self: center;
  margin-bottom: 4px;
  text-align: center;
  white-space: nowrap;
}
.generic-summary-controls label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}
.generic-summary-controls input {
  width: 13px;
  height: 13px;
}
.generic-form-save-state {
  color: var(--muted);
  font-size: 13px;
  margin-left: auto;
}
@media (max-width: 900px) {
  .generic-forms-layout {
    grid-template-columns: 1fr;
  }
  .generic-sheet-wrap {
    max-height: none;
  }
}

/* Admin table width fix: prefer horizontal scrolling over compressed columns. */
.content:has(.admin-table-wrap) .admin-table-wrap {
  overflow-x: auto !important;
  max-width: 100% !important;
}

.content:has(.admin-table-wrap) .admin-table {
  width: max-content !important;
  min-width: 1480px !important;
  table-layout: auto !important;
}

.content:has(.admin-table-wrap) .admin-table th,
.content:has(.admin-table-wrap) .admin-table td {
  white-space: normal !important;
  overflow: visible !important;
}

.content:has(.admin-table-wrap) .admin-table th:nth-child(1),
.content:has(.admin-table-wrap) .admin-table td:nth-child(1) {
  width: 220px !important;
  min-width: 220px !important;
}

.content:has(.admin-table-wrap) .admin-table th:nth-child(3),
.content:has(.admin-table-wrap) .admin-table td:nth-child(3) {
  width: 220px !important;
  min-width: 220px !important;
}

.content:has(.admin-table-wrap) .admin-table th:nth-child(6),
.content:has(.admin-table-wrap) .admin-table td:nth-child(6) {
  width: 360px !important;
  min-width: 360px !important;
}

.content:has(.admin-table-wrap) .admin-table th:nth-child(7),
.content:has(.admin-table-wrap) .admin-table td:nth-child(7) {
  width: 330px !important;
  min-width: 330px !important;
}

.content:has(.admin-table-wrap) .admin-table th:nth-child(8),
.content:has(.admin-table-wrap) .admin-table td:nth-child(8) {
  width: 150px !important;
  min-width: 150px !important;
}

.content:has(.admin-table-wrap) .admin-table th:nth-child(9),
.content:has(.admin-table-wrap) .admin-table td:nth-child(9) {
  width: 90px !important;
  min-width: 90px !important;
}

.content:has(.admin-table-wrap) .admin-usage-cell {
  min-width: 300px !important;
  text-align: left !important;
  word-break: keep-all;
}

/* Local UI polish: settings, attachments, score import and admin alignment. */
#settingsEmail[readonly] {
  background: #f1f5f9 !important;
  color: #64748b !important;
  cursor: not-allowed !important;
}

#accountSettingsForm .form-row button[type="submit"] {
  min-height: 42px !important;
  height: 42px !important;
  width: 100% !important;
  align-self: end !important;
}

.settings-right-stack .archived-memos-panel {
  margin-top: 0 !important;
  border-top: 0 !important;
  padding-top: 16px !important;
}

.score-import-panel .upload-box.compact-upload {
  margin-top: 12px !important;
}

.attachment-manager-filters select,
.attachment-manager-filters input[type="date"],
.calendar-date-selects select {
  height: 40px !important;
  min-height: 40px !important;
  padding: 8px 10px !important;
  border: 1px solid var(--line) !important;
  border-radius: 6px !important;
  background: #fff !important;
}

.calendar-date-selects select {
  height: 44px !important;
  min-height: 44px !important;
  padding: 0 38px 0 12px !important;
  line-height: 42px !important;
  vertical-align: middle !important;
  font-size: 16px !important;
  box-sizing: border-box !important;
}

.calendar-date-selects [data-memo-calendar-year] {
  width: 148px !important;
  min-width: 148px !important;
  padding-right: 44px !important;
}

.calendar-date-selects [data-memo-calendar-month],
.calendar-date-selects .calendar-day-select {
  width: 104px !important;
  min-width: 104px !important;
}

.calendar-date-selects .calendar-week-select {
  width: 260px !important;
  min-width: 220px !important;
}

.calendar-date-selects {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.content:has(.admin-table-wrap) .admin-table {
  min-width: 1600px !important;
  table-layout: fixed !important;
}

.content:has(.admin-table-wrap) .admin-table th,
.content:has(.admin-table-wrap) .admin-table td {
  vertical-align: middle !important;
}

.content:has(.admin-table-wrap) .admin-table th:nth-child(1),
.content:has(.admin-table-wrap) .admin-table td:nth-child(1) {
  width: 260px !important;
  min-width: 260px !important;
}

.content:has(.admin-table-wrap) .admin-table th:nth-child(2),
.content:has(.admin-table-wrap) .admin-table td:nth-child(2) {
  width: 120px !important;
  min-width: 120px !important;
}

.content:has(.admin-table-wrap) .admin-table th:nth-child(3),
.content:has(.admin-table-wrap) .admin-table td:nth-child(3) {
  width: 260px !important;
  min-width: 260px !important;
}

.content:has(.admin-table-wrap) .admin-table th:nth-child(4),
.content:has(.admin-table-wrap) .admin-table td:nth-child(4),
.content:has(.admin-table-wrap) .admin-table th:nth-child(5),
.content:has(.admin-table-wrap) .admin-table td:nth-child(5) {
  width: 140px !important;
  min-width: 140px !important;
}

.content:has(.admin-table-wrap) .admin-table th:nth-child(6),
.content:has(.admin-table-wrap) .admin-table td:nth-child(6) {
  width: 360px !important;
  min-width: 360px !important;
}

.content:has(.admin-table-wrap) .admin-table th:nth-child(7),
.content:has(.admin-table-wrap) .admin-table td:nth-child(7) {
  width: 360px !important;
  min-width: 360px !important;
}

.content:has(.admin-table-wrap) .admin-table th:nth-child(8),
.content:has(.admin-table-wrap) .admin-table td:nth-child(8) {
  width: 170px !important;
  min-width: 170px !important;
}

.content:has(.admin-table-wrap) .admin-table th:nth-child(9),
.content:has(.admin-table-wrap) .admin-table td:nth-child(9) {
  width: 90px !important;
  min-width: 90px !important;
}

.admin-email-cell {
  display: table-cell !important;
  line-height: 1.35 !important;
}

.admin-email-cell strong,
.admin-email-cell .tag {
  display: block !important;
  margin: 3px 0 !important;
}

.admin-email-cell .tag {
  width: fit-content !important;
  max-width: 100% !important;
}

/* Dashboard focus cards: collapse before the controls start overflowing. */
.dashboard-focus-panel .dashboard-focus-columns {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)) !important;
}

/* Calendar week/day interactions: compact cards, hover highlight, click-to-edit affordance. */
.memo-calendar-section .calendar-chip,
.memo-calendar-section .event-row,
.memo-calendar-section .event-main {
  cursor: pointer !important;
}

.memo-calendar-section .calendar-chip {
  white-space: nowrap !important;
  text-overflow: ellipsis !important;
  overflow: hidden !important;
  overflow-wrap: normal !important;
}

.memo-calendar-section .calendar-chip:hover,
.memo-calendar-section .event-row:hover,
.memo-calendar-section .calendar-timeline-event:hover {
  border-color: var(--primary) !important;
  background: #e9f8fb !important;
  box-shadow: inset 3px 0 0 var(--primary) !important;
}

.memo-calendar-section .calendar-day[data-calendar-date] {
  cursor: pointer !important;
}

.memo-calendar-section .calendar-day.is-selected {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 2px rgba(30, 136, 168, 0.18) !important;
  background: #f0fafc !important;
}

.memo-calendar-section .calendar-day.is-selected > strong {
  color: var(--primary-dark) !important;
}

.memo-week-grid .memo-day-events,
.memo-day-focus .memo-scroll,
.memo-day-events {
  align-content: start !important;
  align-items: start !important;
}

.memo-day-focus .memo-scroll {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)) !important;
  gap: 10px !important;
  max-height: min(520px, 54vh) !important;
  overflow-y: auto !important;
  padding-right: 6px !important;
}

.memo-day-focus .memo-scroll .empty {
  grid-column: 1 / -1 !important;
}

.memo-week-grid .event-row,
.memo-day-focus .event-row,
.memo-day-events .event-row {
  min-height: 72px !important;
  height: 72px !important;
  max-height: 72px !important;
  padding: 8px !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center !important;
  align-self: start !important;
  gap: 6px !important;
  overflow: hidden !important;
}

.memo-week-grid .event-main,
.memo-day-focus .event-main,
.memo-day-events .event-main {
  display: grid !important;
  grid-template-columns: auto minmax(56px, 1fr) minmax(80px, 1.2fr) !important;
  align-items: center !important;
  gap: 6px !important;
  min-width: 0 !important;
  overflow: hidden !important;
}

.memo-week-grid .event-main .tag,
.memo-day-focus .event-main .tag,
.memo-day-events .event-main .tag {
  justify-self: start !important;
}

.memo-week-grid .event-main strong,
.memo-day-focus .event-main strong,
.memo-day-events .event-main strong,
.memo-week-grid .event-main small,
.memo-day-focus .event-main small,
.memo-day-events .event-main small {
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.memo-week-grid .event-main .tag,
.memo-day-focus .event-main .tag,
.memo-day-events .event-main .tag {
  max-width: 52px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.memo-week-grid .event-row .danger,
.memo-day-focus .event-row .danger,
.memo-day-events .event-row .danger {
  padding: 0 2px !important;
  white-space: nowrap !important;
}

.memo-week-grid .event-main {
  grid-template-columns: auto minmax(0, 1fr) !important;
}

.memo-week-grid .event-main small {
  grid-column: 1 / -1 !important;
}

.memo-day-focus .event-row {
  min-height: 88px !important;
  height: 88px !important;
  max-height: 88px !important;
}

.memo-day-focus .event-main {
  grid-template-columns: auto minmax(0, 1fr) !important;
  grid-template-rows: auto auto !important;
}

.memo-day-focus .event-main small {
  grid-column: 1 / -1 !important;
}

.memo-todo-toolbar .compact-toolbar {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
}

.memo-todo-toolbar .compact-toolbar select,
.memo-todo-toolbar .compact-toolbar button {
  height: 44px !important;
  min-height: 44px !important;
  box-sizing: border-box !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  margin: 0 !important;
}

.memo-todo-toolbar .compact-toolbar select {
  padding: 0 38px 0 14px !important;
}

.memo-todo-toolbar .compact-toolbar [data-new-todo] {
  background: linear-gradient(135deg, var(--primary), #23a094) !important;
  background-color: var(--primary) !important;
  border-color: transparent !important;
  color: #fff !important;
  min-width: 116px !important;
  padding: 0 18px !important;
  border-radius: 8px !important;
  box-shadow: none !important;
  font-weight: 700 !important;
  opacity: 1 !important;
  visibility: visible !important;
  text-shadow: none !important;
}

.memo-todo-toolbar .compact-toolbar [data-new-todo]:hover {
  filter: brightness(1.03) !important;
  transform: none !important;
}

@media (max-width: 900px) {
  .memo-week-grid .event-main,
  .memo-day-focus .event-main,
  .memo-day-events .event-main {
    grid-template-columns: auto minmax(0, 1fr) !important;
  }

  .memo-week-grid .event-main small,
  .memo-day-focus .event-main small,
  .memo-day-events .event-main small {
    grid-column: 1 / -1 !important;
  }
}

.student-honor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.student-honor-card {
  display: grid;
  grid-template-rows: minmax(120px, 1fr) auto;
  gap: 8px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.student-honor-card:hover {
  border-color: var(--brand);
}

.student-honor-card img {
  width: 100%;
  height: 100%;
  min-height: 120px;
  max-height: 190px;
  object-fit: contain;
  border-radius: 4px;
  background: var(--panel);
}

.student-honor-card.is-pdf {
  align-content: center;
}

.student-honor-file-icon {
  display: grid;
  place-items: center;
  min-height: 120px;
  border-radius: 4px;
  background: #fff3f0;
  color: #b42318;
  font-size: 24px;
  font-weight: 800;
}

.student-honor-card span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.honor-drop-zone {
  min-height: 92px;
  cursor: pointer;
}

.honor-drop-zone.drag-over {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 8%, var(--panel));
}

html,
body,
#view,
.modal,
.memo-scroll,
.quick-record-scroll,
.work-log-scroll,
.dashboard-item-grid,
.calendar-list,
.chat-stream,
.student-table-wrap,
.admin-table-wrap {
  scroll-behavior: auto;
}

/* Calendar date state and vertical day timeline. */
.memo-calendar-section .calendar-day.is-today,
.memo-calendar-section .memo-day-column.is-today {
  border-color: var(--primary) !important;
  box-shadow: inset 0 0 0 1px var(--primary) !important;
  background: #f0fafc !important;
}

.memo-calendar-section .calendar-day.is-today > strong,
.memo-calendar-section .memo-day-column.is-today .memo-day-head strong {
  color: var(--primary-dark) !important;
}

.calendar-day-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.calendar-day-toolbar h3 {
  margin: 0 0 3px;
}

.calendar-date-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(52px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
  padding: 2px 2px 6px;
}

.calendar-date-strip-item {
  min-width: 52px;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 6px;
  cursor: pointer;
}

.calendar-date-strip-item small {
  color: var(--muted);
}

.calendar-date-strip-item strong {
  font-size: 17px;
}

.calendar-date-strip-item:hover {
  border-color: var(--primary);
  background: #f0fafc;
}

.calendar-date-strip-item.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.calendar-date-strip-item.active small {
  color: #e8fbff;
}

.calendar-date-strip-item.is-today {
  box-shadow: 0 0 0 2px rgba(30, 136, 168, 0.2);
}

.calendar-day-timeline {
  max-height: min(680px, 68vh);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  scroll-behavior: auto;
}

.calendar-hour-row {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  min-height: 72px;
}

.calendar-hour-row > time {
  padding: 10px 12px 0 0;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.calendar-hour-content {
  position: relative;
  min-width: 0;
  min-height: 72px;
  border-top: 1px solid var(--line);
  padding: 7px 10px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.calendar-hour-row:first-child .calendar-hour-content {
  border-top: 0;
}

.calendar-timeline-event {
  position: relative;
  z-index: 2;
  min-height: 48px;
  border: 1px solid #b9dce5;
  border-left: 4px solid var(--primary);
  border-radius: 6px;
  background: #eef9fb;
  display: grid;
  grid-template-columns: auto minmax(90px, 1fr) minmax(110px, auto) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  cursor: pointer;
  overflow: hidden;
}

.calendar-timeline-event strong,
.calendar-timeline-event small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-timeline-event small {
  color: var(--muted);
}

.calendar-timeline-event .danger {
  padding: 2px 4px;
  white-space: nowrap;
}

.calendar-now-line {
  position: absolute;
  z-index: 3;
  top: calc(var(--minute-offset) * 1px);
  left: 0;
  right: 0;
  height: 2px;
  background: #ef4444;
  pointer-events: none;
}

.calendar-now-line span {
  position: absolute;
  right: calc(100% + 7px);
  top: 50%;
  transform: translateY(-50%);
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  line-height: 20px;
  padding: 0 6px;
  white-space: nowrap;
}

.calendar-outside-hours {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  margin-bottom: 10px;
  padding: 10px;
}

.calendar-outside-hours > div {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

@media (max-width: 760px) {
  .calendar-date-strip {
    grid-template-columns: repeat(7, 58px);
  }

  .calendar-hour-row {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .calendar-hour-row > time {
    padding-right: 8px;
    font-size: 12px;
  }

  .calendar-timeline-event {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .calendar-timeline-event small {
    grid-column: 1 / -1;
  }
}

.score-exam-list-modal {
  max-width: min(900px, 92vw);
}

.score-exam-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  max-height: 52vh;
  overflow: auto;
}

.score-exam-list-item {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(110px, .42fr) minmax(100px, .38fr) minmax(80px, .32fr) auto;
  gap: 10px;
  align-items: center;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--card, #fff);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  cursor: pointer;
}

.score-exam-list-item:hover {
  border-color: var(--primary);
  background: rgba(30, 136, 168, 0.08);
}

.work-log-report-modal {
  max-width: min(860px, 92vw);
}

.work-log-report-result {
  margin-top: 12px;
}

.work-log-report-list {
  display: grid;
  gap: 8px;
  max-height: 52vh;
  overflow: auto;
  margin-top: 10px;
}

.work-log-report-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: var(--card, #fff);
}

.work-log-report-item small {
  display: block;
  color: var(--muted);
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  .score-exam-list-item {
    grid-template-columns: 1fr;
  }
}

.dashboard-focus-panel .dashboard-block-head {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 8px !important;
  min-width: 0 !important;
}

.dashboard-focus-panel .dashboard-block-head h3 {
  min-width: 0 !important;
  white-space: normal !important;
}

.dashboard-focus-panel .dashboard-watch-controls-row {
  min-width: 0 !important;
  overflow: visible !important;
}

.dashboard-focus-panel .dashboard-watch-controls label > span {
  flex-wrap: wrap !important;
  row-gap: 6px !important;
  min-width: 0 !important;
}

.dashboard-focus-panel .dashboard-watch-number input {
  width: 50px !important;
  min-width: 50px !important;
}

.dashboard-focus-panel .empty {
  min-width: 0 !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

@media (max-width: 1180px) {
  .dashboard-focus-panel .dashboard-focus-columns {
    grid-template-columns: 1fr !important;
  }
}

/* Student strategy MVP */
.student-strategy-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.strategy-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  gap: 10px;
}

.strategy-metrics .mini {
  appearance: none;
  min-height: 68px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.strategy-metrics .mini:hover,
.strategy-metrics .mini.active {
  border-color: var(--primary);
  background: #f1fafc;
}

.strategy-metrics .mini strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
  color: var(--ink);
}

.strategy-filter-bar {
  align-items: stretch;
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(260px, 1fr) minmax(150px, 210px);
}

.strategy-followups {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.strategy-followup-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 176px;
  overflow-y: auto;
}

.strategy-followup-item {
  appearance: none;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f9fcfd;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.strategy-followup-item:hover {
  border-color: var(--primary);
}

.strategy-followup-item > span:not(.tag) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.strategy-followup-item time {
  color: var(--muted);
  font-size: 12px;
}

.strategy-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.strategy-card {
  appearance: none;
  width: 100%;
  min-height: 214px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
}

.strategy-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.strategy-card-head,
.strategy-card-foot,
.strategy-fact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.strategy-card-reasons {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 42px;
  margin-bottom: 10px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.4;
}

.strategy-card-reasons span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.strategy-card-head strong {
  display: block;
  font-size: 20px;
}

.strategy-card-head span,
.strategy-card-foot,
.strategy-fact-row {
  color: var(--muted);
  font-size: 13px;
}

.strategy-fact-row {
  margin: 14px 0 10px;
  padding: 10px 0;
  border-top: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
}

.strategy-status {
  flex: 0 0 auto;
  padding: 4px 9px;
  border-radius: 999px;
  font-style: normal;
  font-size: 12px;
  border: 1px solid var(--line);
  background: #f7f9fc;
}

.strategy-status-active {
  color: var(--primary);
  background: #e8f6fa;
  border-color: #9bd4df;
}

.strategy-status-review {
  color: var(--amber);
  background: #fff7e8;
  border-color: #f4cf92;
}

.strategy-status-focus {
  color: var(--red);
  background: #fff1f0;
  border-color: #f4b5ad;
}

.strategy-status-stable {
  color: var(--green);
  background: #edf9f1;
  border-color: #a9dfb6;
}

.strategy-detail-modal {
  width: min(1570px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  overflow: auto;
}

.strategy-detail-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.strategy-detail-section {
  padding: 16px;
  min-width: 0;
}

.strategy-detail-section h3 {
  margin-bottom: 10px;
}

.strategy-evidence-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.strategy-evidence-block {
  min-height: 120px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fcfd;
}

.strategy-evidence-block strong {
  display: block;
  margin-bottom: 8px;
}

.strategy-evidence-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: start;
  padding: 8px 0;
  border-top: 1px dashed var(--line);
}

.strategy-evidence-item:first-of-type {
  border-top: 0;
}

.strategy-evidence-item small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.45;
}

.strategy-tag-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.strategy-tag-checks label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

.strategy-editor-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.strategy-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.strategy-inline-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.strategy-inline-form textarea {
  min-height: 78px;
}

.strategy-inline-form .modal-actions {
  margin-top: 0;
}

.strategy-draft-section .compact-head {
  margin-bottom: 10px;
}

.strategy-draft-output.empty,
.strategy-draft-output .empty {
  margin-top: 8px;
}

.strategy-draft-card {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  width: 100%;
  min-width: 0;
  text-align: left;
}

.strategy-draft-block {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  min-width: 0;
  max-width: 100%;
  text-align: left;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.strategy-draft-block p {
  margin: 8px 0;
  line-height: 1.6;
}

.strategy-draft-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.strategy-draft-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px dashed var(--line);
  min-width: 0;
  text-align: left;
}

.strategy-draft-item > div,
.strategy-draft-output,
.strategy-draft-output strong,
.strategy-draft-output small {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: left;
}

.strategy-detail-modal .modal-head {
  gap: 10px;
}

.strategy-detail-modal .modal-head > div:first-child {
  min-width: 0;
  margin-right: auto;
}

.strategy-draft-item:first-of-type {
  border-top: 0;
}

.strategy-draft-item small {
  display: block;
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

@media (max-width: 1100px) {
  .strategy-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .strategy-editor-grid,
  .strategy-evidence-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .strategy-filter-bar,
  .strategy-followup-list {
    grid-template-columns: 1fr;
  }

  .strategy-followup-item {
    grid-template-columns: auto auto minmax(0, 1fr);
  }

  .strategy-followup-item time {
    display: none;
  }
}

@media (max-width: 640px) {
  .strategy-metrics,
  .strategy-card-grid {
    grid-template-columns: 1fr;
  }

  .strategy-detail-modal {
    width: calc(100vw - 20px);
  }

  .strategy-draft-item {
    grid-template-columns: 1fr;
  }
}

/* Student weekly check-in v0.1 */
.checkin-portal-modal {
  width: min(1180px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.checkin-admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.checkin-review-panel {
  grid-column: 1 / -1;
}

.checkin-admin-panel {
  min-width: 0;
}

.checkin-link-box,
.checkin-code-row,
.checkin-review-card {
  border: 1px solid var(--line, #cfe0ec);
  background: #f8fcff;
  border-radius: 8px;
  padding: 10px;
}

.checkin-link-box {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin: 10px 0;
}

.checkin-link-box input {
  width: 100%;
  min-width: 0;
}

.checkin-print-card {
  margin-top: 10px;
  border: 1px dashed #8bb8cc;
  border-radius: 8px;
  padding: 12px;
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 6px 12px;
  align-items: center;
  color: #234;
}

.checkin-print-card img {
  grid-row: 1 / span 4;
  width: 132px;
  height: 132px;
  object-fit: contain;
  border: 1px solid #cfe0ec;
  border-radius: 6px;
  background: #fff;
}

.checkin-print-card small {
  word-break: break-all;
}

.checkin-print-card .secondary-btn {
  justify-self: start;
  text-decoration: none;
}

.checkin-code-list,
.checkin-review-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.checkin-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.checkin-code-row div {
  min-width: 0;
  display: grid;
}

.checkin-code-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.checkin-review-card {
  display: grid;
  gap: 6px;
}

.checkin-review-card p,
.checkin-review-card small {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.checkin-review-card textarea {
  width: 100%;
  min-height: 64px;
  resize: vertical;
}

.checkin-review-card > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.student-checkin-page {
  min-height: 100vh;
  background: #eef6fa;
  padding: 18px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.student-checkin-card {
  width: min(680px, 100%);
  background: #fff;
  border: 1px solid #cfe0ec;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(21, 86, 112, 0.08);
  padding: 18px;
  display: grid;
  gap: 12px;
}

.student-checkin-card h1 {
  margin: 0;
  font-size: 24px;
}

.student-checkin-card label {
  display: grid;
  gap: 6px;
  font-weight: 700;
  color: #19324a;
}

.student-checkin-card input,
.student-checkin-card select,
.student-checkin-card textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #b9d2e3;
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
}

.student-checkin-card textarea {
  min-height: 82px;
  resize: vertical;
}

.student-checkin-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.checkin-score-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.checkin-feedback {
  background: #f3fbf6;
  border: 1px solid #bde4c8;
  border-radius: 8px;
  padding: 10px;
}

.checkin-feedback p {
  margin: 4px 0 0;
  white-space: pre-wrap;
}

.student-checkin-history {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid #d8e7ef;
}

.student-checkin-history h2 {
  margin: 0;
  font-size: 18px;
}

.student-checkin-history article {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid #d8e7ef;
  border-radius: 8px;
  background: #f8fcff;
}

.student-checkin-history article > div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.student-checkin-history p,
.student-checkin-history small {
  margin: 0;
  overflow-wrap: anywhere;
}

.strategy-startup-callout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #9ecbdd;
  border-left: 4px solid #1688a4;
  border-radius: 8px;
  background: #f2fbfe;
}

.strategy-startup-callout p {
  margin: 4px 0 0;
  color: var(--muted);
}

.strategy-weekly-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.strategy-weekly-item {
  border: 1px solid var(--line, #cfe0ec);
  background: #f8fcff;
  border-radius: 8px;
  padding: 10px;
  display: grid;
  gap: 6px;
  min-width: 0;
}

.strategy-weekly-head,
.strategy-weekly-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.strategy-weekly-head {
  justify-content: space-between;
}

.strategy-weekly-item p {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.strategy-weekly-meta {
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 760px) {
  .checkin-admin-grid,
  .checkin-score-grid {
    grid-template-columns: 1fr;
  }
  .checkin-link-box,
  .checkin-code-row {
    grid-template-columns: 1fr;
  }
  .checkin-print-card,
  .strategy-startup-callout {
    grid-template-columns: 1fr;
  }
  .checkin-print-card img {
    grid-row: auto;
    justify-self: center;
  }
  .student-checkin-page {
    padding: 10px;
  }
  .student-checkin-card {
    padding: 14px;
  }
}

/* Quick record and work-log refinements. */
.work-log-kind-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 10px;
  margin: 8px 0 14px;
}

.work-log-kind-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 48px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.work-log-kind-filter strong {
  color: var(--brand);
  font-size: 18px;
}

.work-log-kind-filter.active {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 12%, var(--panel));
}

.work-log-report-list {
  display: grid;
  grid-auto-rows: 64px;
  align-content: start;
  gap: 8px;
  max-height: min(56vh, 560px);
  overflow-y: auto;
  padding-right: 4px;
}

.work-log-report-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 64px;
  min-height: 64px;
  max-height: 64px;
  padding: 8px 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.work-log-report-item > div {
  min-width: 0;
  overflow: hidden;
}

.work-log-report-item strong,
.work-log-report-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-memo-editor-modal {
  width: min(920px, 94vw);
}

.quick-memo-editor-top,
.quick-memo-attachment-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.quick-memo-editor-top .form-row {
  flex: 1 1 340px;
  margin: 0;
}

.quick-memo-editor-modal textarea {
  min-height: 260px;
}

.modal-backdrop:has(.work-log-report-modal) {
  align-items: flex-start;
  padding-top: 4vh;
}

.work-log-report-modal {
  width: min(940px, 94vw);
  max-width: min(940px, 94vw);
  height: min(760px, 88vh);
  display: flex;
  flex-direction: column;
}

.work-log-report-modal .modal-head,
.work-log-report-modal > .form-grid {
  flex: 0 0 auto;
}

.work-log-report-result {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.work-log-kind-row {
  flex: 0 0 auto;
  grid-template-columns: repeat(7, minmax(86px, 1fr));
}

.work-log-report-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

.work-log-kind-filter.kind-all {
  --kind-color: #1e88a8;
}

.work-log-kind-filter.kind-leave,
.work-log-kind-filter.kind-memo {
  --kind-color: #c78300;
}

.work-log-kind-filter.kind-communication {
  --kind-color: #1798a7;
}

.work-log-kind-filter.kind-behavior {
  --kind-color: #cf3d3d;
}

.work-log-kind-filter.kind-todo {
  --kind-color: #188b55;
}

.work-log-kind-filter.kind-calendar {
  --kind-color: #2376bc;
}

.work-log-kind-filter {
  border-color: color-mix(in srgb, var(--kind-color, var(--brand)) 45%, var(--line));
  background: color-mix(in srgb, var(--kind-color, var(--brand)) 8%, var(--panel));
}

.work-log-kind-filter strong {
  color: var(--kind-color, var(--brand));
}

.work-log-kind-filter.active {
  border-color: var(--kind-color, var(--brand));
  background: color-mix(in srgb, var(--kind-color, var(--brand)) 16%, var(--panel));
}

.score-filter-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.score-overview-inline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.score-overview-inline .mini {
  min-height: 64px;
}

@media (max-width: 900px) {
  .score-filter-grid,
  .score-overview-inline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.material-save-attachment {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  min-width: max-content;
  flex-shrink: 0;
  color: var(--text);
  white-space: nowrap;
}

.material-save-attachment input {
  flex: 0 0 auto;
  width: auto;
  margin: 0;
}

.material-merge-save-attachment {
  margin-top: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-soft, #f7fbfd);
}

.record-attachment-section {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line, #cbdde7);
  border-radius: 6px;
  background: var(--surface-soft, #f7fbfd);
}

.record-attachment-section .section-head {
  margin-bottom: 8px;
}

.record-attachment-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.calendar-pending-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.calendar-pending-attachment {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.calendar-pending-attachment > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: currentColor;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}

.calendar-pending-attachment > button:hover {
  background: rgb(0 0 0 / 10%);
}

.record-attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.record-attachment-list .memo-attachment-chip {
  max-width: min(320px, 100%);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-attachment-count {
  display: inline-flex;
  align-items: center;
  width: max-content;
  max-width: 100%;
  color: var(--primary, #168ea1);
  font-size: 13px;
  line-height: 1.3;
  white-space: nowrap;
}
/* Keep active todo text inside its grid column instead of flowing under actions. */
.memo-todo-panel .compact-todo-item > .todo-row-main {
  min-width: 0 !important;
  max-width: 100% !important;
  overflow: hidden !important;
}

.memo-todo-panel .compact-todo-item .todo-row-title,
.memo-todo-panel .compact-todo-item .todo-row-meta {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* Give metadata chips the full card width; action buttons only share the text rows. */
.memo-todo-panel .compact-todo-item > .todo-row-tags {
  grid-column: 1 / -1 !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin-top: 0 !important;
  overflow: hidden !important;
}

.memo-todo-panel .compact-todo-item > .todo-row-tags .tag {
  flex: 0 0 auto !important;
  max-width: none !important;
  white-space: nowrap !important;
}

/* Active todo cards use two explicit rows so the chip row cannot be clipped. */
.memo-todo-panel .compact-todo-item:not(.completed) {
  grid-template-columns: minmax(0, 1fr) auto !important;
  grid-template-rows: 62px 28px !important;
  column-gap: 8px !important;
  row-gap: 4px !important;
  box-sizing: border-box !important;
  height: 112px !important;
  min-height: 112px !important;
  max-height: 112px !important;
  padding: 8px 10px !important;
  align-items: center !important;
}

.memo-todo-panel .compact-todo-item:not(.completed) > .todo-row-main {
  grid-column: 1 !important;
  grid-row: 1 !important;
  display: grid !important;
  grid-template-rows: 22px 32px !important;
  gap: 4px !important;
  height: 58px !important;
  align-self: center !important;
}

.memo-todo-panel .compact-todo-item:not(.completed) > .todo-row-actions {
  grid-column: 2 !important;
  grid-row: 1 !important;
  align-self: center !important;
}

.memo-todo-panel .compact-todo-item:not(.completed) > .todo-row-tags {
  grid-row: 2 !important;
  height: 28px !important;
  min-height: 28px !important;
  max-height: 28px !important;
  align-self: end !important;
}
/* Smart entry workbench */
.dashboard-home-v3 {
  --workbench-primary: #148a92;
  --workbench-primary-strong: #0f6f78;
  --workbench-canvas: #f3f8fa;
  --workbench-danger: #d65a4a;
  display: grid;
  gap: 16px;
}

.dashboard-smart-entry-panel {
  min-width: 0;
  overflow: hidden;
}

.dashboard-smart-entry {
  display: grid;
  grid-template-columns: minmax(0, 42fr) minmax(0, 58fr);
  gap: 16px;
  align-items: stretch;
}

.smart-entry-form,
.smart-entry-results,
.smart-entry-draft-card,
.smart-entry-draft-main,
.smart-entry-draft-title {
  min-width: 0;
}

.smart-entry-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.smart-entry-form textarea {
  width: 100%;
  min-height: 214px;
  resize: vertical;
}

.smart-entry-submit-row,
.smart-entry-results-head,
.smart-entry-draft-title,
.smart-entry-draft-actions,
.smart-honor-attachment-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.student-honor-records {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.student-honor-record-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid #c9dce4;
  border-left: 3px solid #d4a72c;
  border-radius: 6px;
  background: #fff;
}

.student-honor-record-head,
.student-honor-record-actions,
.detail-honor-legacy-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.student-honor-record-head,
.detail-honor-legacy-head {
  justify-content: space-between;
}

.student-honor-record-head > div:first-child {
  min-width: 0;
}

.student-honor-record-head strong,
.student-honor-record-card p {
  overflow-wrap: anywhere;
}

.detail-honor-legacy-head {
  margin: 8px 0;
}

.detail-honor-legacy-head h4 {
  margin: 0;
}

.smart-entry-submit-row {
  justify-content: space-between;
}

.smart-entry-submit-row .muted {
  min-width: 0;
  overflow-wrap: anywhere;
}

.smart-entry-results {
  display: flex;
  flex-direction: column;
  min-height: 270px;
  padding: 14px;
  border: 1px solid #cfe0e6;
  border-radius: 6px;
  background: var(--workbench-canvas);
}

.smart-entry-results-head {
  justify-content: space-between;
  margin-bottom: 10px;
}

.smart-entry-results-head h3 {
  margin: 0;
}

.smart-entry-draft-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 3px;
}

.smart-entry-draft-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid #c8dbe2;
  border-left: 3px solid var(--workbench-primary);
  border-radius: 6px;
  background: #fff;
}

.smart-entry-draft-title strong,
.smart-entry-draft-main p {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.smart-entry-draft-title strong {
  white-space: nowrap;
}

.smart-entry-draft-main p {
  display: -webkit-box;
  margin: 6px 0 0;
  color: #526574;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}

.smart-entry-draft-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.smart-entry-merge-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.dashboard-secondary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

.dashboard-growth-report-panel {
  min-width: 0;
}

.dashboard-growth-report-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1.25fr) minmax(180px, 1fr) minmax(280px, 1.5fr) auto;
  gap: 12px;
  align-items: end;
}

.dashboard-growth-report-controls > label,
.dashboard-growth-report-custom > label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: #496776;
  font-size: var(--ui-helper-size, 13px);
}

.dashboard-growth-report-controls select,
.dashboard-growth-report-controls input {
  width: 100%;
  min-width: 0;
}

.dashboard-growth-report-custom {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.dashboard-growth-report-custom[hidden] {
  display: none;
}

.dashboard-growth-report-controls [data-dashboard-generate-report],
.dashboard-growth-report-controls [data-dashboard-download-report] {
  min-width: 112px;
  white-space: nowrap;
}

.dashboard-growth-report-status {
  min-height: 20px;
  margin-top: 10px;
}

.dashboard-attachment-package-panel {
  min-width: 0;
}

.dashboard-attachment-package-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1.25fr) minmax(180px, 1fr) minmax(280px, 1.5fr);
  gap: 12px;
  align-items: end;
}

.dashboard-attachment-package-controls > label,
.dashboard-attachment-package-custom > label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: #496776;
  font-size: var(--ui-helper-size, 13px);
}

.dashboard-attachment-package-controls select,
.dashboard-attachment-package-controls input {
  width: 100%;
  min-width: 0;
}

.dashboard-attachment-package-custom {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.dashboard-attachment-package-custom[hidden] {
  display: none;
}

.dashboard-attachment-sources {
  min-width: 0;
  margin: 14px 0 0;
  padding: 12px;
  border: 1px solid var(--ui-border, #d2e0e5);
  border-radius: 8px;
  background: var(--ui-surface-soft, #f7fbfc);
}

.dashboard-attachment-sources legend {
  padding: 0 6px;
  color: var(--ui-text, #1f2f3a);
  font-size: var(--ui-helper-size, 13px);
  font-weight: 700;
}

.dashboard-attachment-source-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.dashboard-attachment-source-grid label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--ui-text, #1f2f3a);
  white-space: nowrap;
}

.dashboard-attachment-package-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  min-width: 0;
}

.dashboard-attachment-package-actions > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.dashboard-attachment-package-actions > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.dashboard-attachment-package-actions button {
  white-space: nowrap;
}

.dashboard-attachment-package-status {
  min-height: 20px;
  margin-top: 8px;
}

.dashboard-class-growth-package-panel {
  min-width: 0;
}

.dashboard-class-growth-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(280px, 1.2fr) auto;
  gap: 12px;
  align-items: end;
}

.dashboard-class-growth-controls > label,
.dashboard-class-growth-custom > label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: #496776;
  font-size: var(--ui-helper-size, 13px);
}

.dashboard-class-growth-controls select,
.dashboard-class-growth-controls input {
  width: 100%;
  min-width: 0;
}

.dashboard-class-growth-custom {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.dashboard-class-growth-custom[hidden] {
  display: none;
}

.dashboard-class-growth-download-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.dashboard-class-growth-download-actions button {
  white-space: nowrap;
}

.dashboard-class-growth-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  min-width: 0;
}

.dashboard-class-growth-actions span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.dashboard-class-growth-status {
  min-height: 20px;
  margin-top: 8px;
}

.dashboard-secondary-grid > .panel,
.dashboard-secondary-grid .dashboard-card-item,
.dashboard-secondary-grid .work-log-item {
  min-width: 0;
  overflow: hidden;
}

.dashboard-secondary-grid .work-log-scroll,
.dashboard-secondary-grid .dashboard-item-grid {
  max-height: 430px;
  overflow-y: auto;
}

.dashboard-secondary-grid .dashboard-watch-line,
.dashboard-secondary-grid .work-log-main strong,
.dashboard-secondary-grid .work-log-main .muted {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.smart-honor-modal {
  width: min(900px, calc(100vw - 32px));
}

.detail-head-actions,
.smart-honor-existing-files {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.smart-honor-existing-files {
  justify-content: flex-start;
  margin-top: 12px;
}

.smart-honor-existing-files .memo-attachment-chip {
  max-width: min(360px, 100%);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.smart-honor-attachment-row {
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed #b8ced7;
  border-radius: 6px;
  min-width: 0;
  flex-wrap: wrap;
}

.smart-honor-attachment-row [data-smart-honor-file] {
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 1100px) {
  .dashboard-secondary-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-growth-report-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dashboard-attachment-package-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dashboard-class-growth-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .dashboard-smart-entry {
    grid-template-columns: 1fr;
  }
  .smart-entry-draft-card {
    grid-template-columns: 1fr;
  }
  .smart-entry-draft-actions {
    justify-content: flex-start;
  }
  .dashboard-growth-report-controls {
    grid-template-columns: 1fr;
  }
  .dashboard-growth-report-custom {
    grid-template-columns: 1fr 1fr;
  }
  .dashboard-attachment-package-controls {
    grid-template-columns: 1fr;
  }
  .dashboard-attachment-package-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .dashboard-attachment-package-actions > div {
    justify-content: flex-start;
  }
  .dashboard-class-growth-controls {
    grid-template-columns: 1fr;
  }
  .dashboard-class-growth-custom {
    grid-template-columns: 1fr 1fr;
  }
  .dashboard-class-growth-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Site-wide visual foundation: final cascade layer. */
:root {
  --ui-font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --ui-font-size: 14px;
  --ui-helper-size: 13px;
  --ui-heading-size: 18px;
  --ui-control-height: 42px;
  --ui-control-compact: 34px;
  --ui-radius: 6px;
  --ui-gap-1: 4px;
  --ui-gap-2: 8px;
  --ui-gap-3: 12px;
  --ui-gap-4: 16px;
  --ui-canvas: #f2f7f9;
  --ui-surface: #ffffff;
  --ui-surface-soft: #f7fbfc;
  --ui-border: #d2e0e5;
  --ui-border-strong: #b8cbd2;
  --ui-primary: #148a92;
  --ui-primary-hover: #0f6f78;
  --ui-danger: #c7473a;
  --ui-success: #2d8a61;
  --ui-text: #1f2f3a;
  --ui-muted: #637685;
  --ui-shadow: 0 3px 12px rgba(24, 54, 67, 0.045);
}

html {
  background: var(--ui-canvas);
}

body {
  font-family: var(--ui-font-family) !important;
  font-size: var(--ui-font-size);
  line-height: 1.5;
  letter-spacing: 0;
  background: var(--ui-canvas);
  color: var(--ui-text);
}

button,
input,
textarea,
select {
  font-family: inherit !important;
  letter-spacing: 0 !important;
}

.primary-btn,
.ghost-btn,
.danger-btn {
  min-height: var(--ui-control-height) !important;
  height: var(--ui-control-height);
  padding: 0 16px !important;
  border-radius: var(--ui-radius) !important;
  font-size: var(--ui-font-size) !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  box-sizing: border-box;
  flex: 0 0 auto;
  overflow: hidden;
  text-overflow: ellipsis;
}

.primary-btn {
  border: 1px solid var(--ui-primary) !important;
  background: var(--ui-primary) !important;
  color: #fff !important;
  box-shadow: none !important;
}

.primary-btn:hover:not(:disabled) {
  border-color: var(--ui-primary-hover) !important;
  background: var(--ui-primary-hover) !important;
  transform: translateY(-1px);
}

.ghost-btn {
  border: 1px solid var(--ui-border-strong) !important;
  background: var(--ui-surface) !important;
  color: var(--ui-text) !important;
  box-shadow: none !important;
}

.ghost-btn:hover:not(:disabled) {
  border-color: var(--ui-primary) !important;
  background: #f1fafb !important;
  color: var(--ui-primary-hover) !important;
  transform: translateY(-1px);
}

.danger-btn,
.primary-btn.danger-btn,
.ghost-btn.danger-btn {
  border-color: var(--ui-danger) !important;
  background: var(--ui-danger) !important;
  color: #fff !important;
}

.text-btn {
  min-height: 32px;
  padding: 0 6px !important;
  border-radius: 4px !important;
  font-size: var(--ui-font-size) !important;
  font-weight: 500 !important;
  line-height: 1.3 !important;
}

.text-btn:hover:not(:disabled) {
  background: #edf8fa;
}

.text-btn.danger:hover:not(:disabled) {
  background: #fff1ef;
}

.compact-btn,
.toolbar .compact-btn,
.section-actions .compact-btn {
  min-height: var(--ui-control-compact) !important;
  height: var(--ui-control-compact) !important;
  padding: 0 12px !important;
  border-radius: var(--ui-radius) !important;
  font-size: var(--ui-helper-size) !important;
  font-weight: 600 !important;
  line-height: 1 !important;
}

.section-head h2,
.panel h2 {
  margin: 0 !important;
  font-size: var(--ui-heading-size) !important;
  font-weight: 700 !important;
  line-height: 1.35 !important;
  color: var(--ui-text);
}

.section-head h3,
.panel h3,
.modal-head h2 {
  margin: 0 !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  line-height: 1.4 !important;
  color: var(--ui-text);
}

.muted,
.panel small,
.section-head .muted,
.modal-head .muted {
  color: var(--ui-muted);
  font-size: var(--ui-helper-size) !important;
  line-height: 1.45;
}

.toolbar,
.compact-toolbar,
.section-head,
.modal-head {
  min-width: 0;
  gap: var(--ui-gap-3);
}

.toolbar,
.compact-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.section-head {
  align-items: center;
  flex-wrap: wrap;
}

.section-head > div:first-child,
.modal-head > div:first-child,
.toolbar > div,
.compact-toolbar > div {
  min-width: 0;
}

.panel,
.stat-card,
.student-card,
.strategy-card,
.generic-form-main {
  min-width: 0;
  border-color: var(--ui-border) !important;
  border-radius: var(--ui-radius) !important;
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow) !important;
}

.panel {
  padding: var(--ui-gap-4);
}

.form-row > input:not([type="checkbox"]):not([type="radio"]),
.form-row > select,
.form-grid > input:not([type="checkbox"]):not([type="radio"]),
.form-grid > select,
.toolbar > select,
.compact-toolbar > select,
.section-actions > select,
.strategy-filter-bar input,
.strategy-filter-bar select {
  min-height: var(--ui-control-height) !important;
  height: var(--ui-control-height) !important;
  padding: 0 12px !important;
  border-color: var(--ui-border-strong) !important;
  border-radius: var(--ui-radius) !important;
  background-color: #fff !important;
  font-size: var(--ui-font-size) !important;
  line-height: 1.2 !important;
}

.form-row > textarea,
.strategy-inline-form textarea {
  border-color: var(--ui-border-strong) !important;
  border-radius: var(--ui-radius) !important;
  font-size: var(--ui-font-size) !important;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--ui-primary) !important;
  box-shadow: 0 0 0 3px rgba(20, 138, 146, 0.12) !important;
}

.tag {
  max-width: 100%;
  border-radius: 4px !important;
  font-size: 12px !important;
  font-weight: 600;
  line-height: 1.35;
}

.memo-main-toolbar .primary-btn,
.memo-todo-toolbar .primary-btn {
  min-width: 128px !important;
}

.memo-main-toolbar .primary-btn,
.memo-main-toolbar .ghost-btn,
.memo-todo-toolbar .primary-btn,
.memo-todo-toolbar .ghost-btn,
.memo-todo-toolbar select {
  min-height: var(--ui-control-height) !important;
  height: var(--ui-control-height) !important;
  font-size: var(--ui-font-size) !important;
  font-weight: 600 !important;
}

.memo-todo-toolbar .compact-toolbar {
  gap: 6px !important;
  flex-wrap: nowrap !important;
}

.memo-todo-toolbar .compact-toolbar select,
.memo-todo-toolbar .compact-toolbar button,
.memo-todo-column .section-head .ghost-btn {
  min-height: var(--ui-control-height) !important;
  height: var(--ui-control-height) !important;
  border-radius: var(--ui-radius) !important;
  font-size: var(--ui-font-size) !important;
  font-weight: 600 !important;
}

.memo-todo-toolbar .compact-toolbar select {
  width: 112px !important;
  min-width: 112px !important;
  padding: 0 30px 0 10px !important;
}

.memo-todo-toolbar .compact-toolbar .ghost-btn {
  width: 100px !important;
  min-width: 100px !important;
  padding: 0 10px !important;
}

.memo-todo-toolbar .compact-toolbar [data-new-todo] {
  width: 100px !important;
  min-width: 100px !important;
  padding: 0 10px !important;
  border-radius: var(--ui-radius) !important;
  border-color: var(--ui-primary) !important;
  background: var(--ui-primary) !important;
  font-size: var(--ui-font-size) !important;
  font-weight: 600 !important;
}

.memo-main-head,
.memo-todo-toolbar {
  min-height: 54px;
  margin-bottom: 12px !important;
}

.memo-todo-column .section-head {
  height: auto !important;
  min-height: 54px !important;
  max-height: none !important;
}

.memo-todo-column .section-head h2 {
  line-height: 1.35 !important;
}

.memo-note-item,
.todo-item,
.archived-memo-item,
.attachment-file-card,
.strategy-followup-item,
.strategy-card,
.generic-form-tab,
.work-log-item,
.dashboard-card-item {
  min-width: 0;
  border-radius: var(--ui-radius) !important;
}

.memo-note-item strong,
.memo-note-item small,
.todo-row-title,
.todo-row-meta,
.archived-memo-item strong,
.archived-memo-item .muted,
.attachment-file-card strong,
.attachment-file-card small,
.strategy-card strong,
.strategy-card span,
.generic-form-tab strong,
.generic-form-tab span,
.work-log-item strong,
.work-log-item .muted,
.dashboard-card-item strong,
.dashboard-card-item .muted {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.student-action-bar,
.student-filter-row,
.strategy-filter-bar,
.generic-form-toolbar,
.attachment-manager-toolbar,
.admin-toolbar,
.score-page-actions {
  gap: var(--ui-gap-3) !important;
}

.student-table-wrap,
.admin-table-wrap,
.attachment-manager-grid,
.archived-memo-list,
.generic-sheet-wrap,
.chat-stream {
  border-radius: var(--ui-radius) !important;
}

.student-table th,
.admin-table th {
  background: #edf6f8;
  color: #344b58;
  font-size: 13px;
  font-weight: 700;
}

.student-table td,
.admin-table td {
  font-size: var(--ui-font-size);
}

.strategy-metrics {
  gap: var(--ui-gap-2);
}

.strategy-metrics .mini {
  min-height: 68px;
  border-radius: var(--ui-radius);
  box-shadow: none;
}

.strategy-card-grid {
  gap: var(--ui-gap-3);
}

.strategy-card {
  padding: 14px;
}

.strategy-detail-section,
.strategy-draft-card,
.strategy-inline-form {
  border-radius: var(--ui-radius) !important;
}

.generic-form-sidebar {
  min-width: 0;
}

.generic-form-toolbar {
  min-height: var(--ui-control-height);
}

.generic-form-title-input {
  min-height: var(--ui-control-height) !important;
  height: var(--ui-control-height) !important;
  font-size: var(--ui-font-size) !important;
}

.chat-page {
  gap: var(--ui-gap-4);
}

.chat-panel,
.chat-side-panel {
  min-width: 0;
}

.chat-input {
  gap: var(--ui-gap-2);
}

.modal {
  border-radius: 8px !important;
  border: 1px solid var(--ui-border);
  box-shadow: 0 20px 48px rgba(18, 43, 54, 0.18) !important;
}

.modal-head {
  padding-bottom: 12px;
  border-bottom: 1px solid #e3ecef;
}

.modal-actions {
  gap: var(--ui-gap-2) !important;
  flex-wrap: wrap;
}

.danger-zone,
.warning-panel {
  border-radius: var(--ui-radius) !important;
}

.primary-btn,
.ghost-btn,
.text-btn,
.compact-btn,
.student-card,
.strategy-card,
.memo-note-item,
.todo-item,
.calendar-chip,
.transaction-tab {
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

@media (max-width: 1000px) {
  .memo-main-toolbar,
  .memo-todo-toolbar .toolbar {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .content {
    padding: 14px !important;
  }

  .panel {
    padding: 14px;
  }

  .memo-main-head,
  .memo-todo-toolbar,
  .section-head,
  .modal-head {
    align-items: stretch !important;
    flex-direction: column !important;
  }

  .memo-main-toolbar,
  .memo-todo-toolbar .toolbar,
  .section-actions,
  .modal-actions {
    width: 100%;
    justify-content: flex-start !important;
  }

  .memo-main-toolbar .primary-btn,
  .memo-main-toolbar .ghost-btn,
  .memo-todo-toolbar .primary-btn,
  .memo-todo-toolbar .ghost-btn,
  .memo-todo-toolbar select {
    min-width: min(100%, 150px) !important;
  }

  .student-action-bar,
  .student-filter-row,
  .strategy-filter-bar,
  .generic-form-toolbar,
  .attachment-manager-toolbar {
    align-items: stretch !important;
  }
}

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

/* Keep the compact school-date controls inside the settings column. */
.settings-date-row {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 8px !important;
}

.settings-date-row .form-row,
.settings-date-row .month-day-selects,
.settings-date-row .month-day-selects select {
  min-width: 0 !important;
}

@media (max-width: 760px) {
  .settings-date-row {
    grid-template-columns: 1fr !important;
  }
}


/* Official filing footer. */
.site-record-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border-top: 1px solid var(--ui-border, #d2e0e5);
  background: #ffffff;
  color: var(--ui-muted, #637685);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.site-record-footer a {
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.site-record-footer a:hover,
.site-record-footer a:focus-visible {
  color: var(--ui-primary, #148a92);
  text-decoration: underline;
}

.site-record-separator {
  color: var(--ui-border-strong, #b8cbd2);
}

@media (max-width: 760px) {
  .site-record-footer {
    gap: 4px 8px;
    padding: 10px 12px;
    font-size: 12px;
  }
}


/* Filing footer viewport fit. */
.login-page,
.app-shell,
.student-checkin-page {
  min-height: calc(100vh - 44px) !important;
}

.app-shell .sidebar {
  min-height: calc(100vh - 44px) !important;
  height: calc(100vh - 44px) !important;
}

@media (max-width: 760px) {
  .app-shell .sidebar {
    min-height: auto !important;
    height: auto !important;
  }
}
.registration-terms-modal {
  width: min(680px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 32px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.registration-terms-content {
  min-height: 0;
  margin: 14px 0;
  padding: 0 14px 0 2px;
  overflow-y: auto;
  color: var(--ui-text, #20313e);
  line-height: 1.7;
  scrollbar-gutter: stable;
}
.registration-terms-content h3 {
  margin: 14px 0 5px;
  font-size: 15px;
  line-height: 1.4;
}
.registration-terms-content h3:first-child { margin-top: 0; }
.registration-terms-content p { margin: 0; overflow-wrap: anywhere; }
.registration-terms-modal .modal-actions {
  margin-top: 0;
  padding-top: 12px;
  border-top: 1px solid var(--ui-border, #d2e0e5);
}
#registerCaptchaElement {
  width: 100%;
  min-height: 42px;
  margin: 2px 0 4px;
  overflow: visible;
}
#registerCaptchaElement > div,
.local-captcha-row {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.local-captcha-image {
  width: 108px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f8fafc;
  object-fit: contain;
}
.local-captcha-input { min-width: 0; height: 48px; }
.local-captcha-refresh { min-width: 88px; height: 48px; white-space: nowrap; }
.admin-invitation-list { display:grid; gap:8px; margin-top:12px; }
.admin-invitation-item { display:grid; grid-template-columns:minmax(180px,1fr) repeat(5,auto); gap:14px; align-items:center; min-height:48px; padding:8px 12px; border:1px solid var(--border); border-radius:6px; background:var(--surface-soft); }
.admin-invitation-code { font-size: 18px; letter-spacing: 2px; }
@media (max-width: 760px) { .admin-invitation-item { grid-template-columns:1fr 1fr; } }
@media (max-width: 620px) {
  .local-captcha-row { grid-template-columns: 108px minmax(0, 1fr) auto; }
}

/* Dense admin operations dashboard. */
.admin-dashboard-shell {
  display: grid;
  gap: 12px;
  width: 100%;
}

.admin-dashboard-head {
  padding: 12px 16px;
}

.admin-dashboard-head .section-head,
.admin-token-trend-panel .section-head,
.admin-operations-grid .section-head {
  margin: 0;
}

.admin-stats-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  gap: 10px !important;
}

.admin-stats-grid .stat-card {
  min-height: 86px;
  padding: 12px 14px;
}

.admin-stats-grid .stat-card .value {
  margin: 2px 0;
  font-size: 24px;
  line-height: 1.15;
}

.admin-stats-grid .stat-card .hint,
.admin-stats-grid .stat-card .label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-token-trend-panel {
  padding: 12px 16px 8px;
}

.admin-token-forecast {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.admin-token-forecast > span {
  display: grid;
  min-width: 112px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-soft);
}

.admin-token-forecast small {
  color: var(--muted);
  font-size: 12px;
}

.admin-token-forecast strong {
  margin-top: 2px;
  color: var(--text);
  font-size: 17px;
}

.admin-token-forecast .forecast-primary {
  border-color: #75bdc4;
  background: #eaf8f8;
}

.admin-token-trend-chart {
  width: 100%;
  height: 190px;
  margin-top: 4px;
  overflow: hidden;
}

.admin-token-trend-chart svg {
  display: block;
  width: 100%;
  height: 100%;
}

.admin-token-grid-line {
  stroke: #d8e5e9;
  stroke-width: 1;
}

.admin-token-area {
  fill: #dff4f2;
  opacity: 0.8;
}

.admin-token-line {
  fill: none;
  stroke: #178f99;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.admin-token-point {
  fill: #ffffff;
  stroke: #178f99;
  stroke-width: 2;
}

.admin-token-point.is-today {
  fill: #d34b3f;
  stroke: #ffffff;
  stroke-width: 2.5;
}

.admin-token-hover-zone {
  cursor: crosshair;
  outline: none;
}

.admin-token-hit-zone {
  fill: transparent;
  pointer-events: all;
}

.admin-token-guide {
  opacity: 0;
  stroke: #168da0;
  stroke-dasharray: 4 3;
  stroke-width: 1.5;
  pointer-events: none;
}

.admin-token-hover-zone .admin-token-tooltip {
  opacity: 0;
  pointer-events: none;
  transition: opacity 100ms ease;
}

.admin-token-hover-zone:hover .admin-token-tooltip,
.admin-token-hover-zone:focus .admin-token-tooltip,
.admin-token-hover-zone:hover .admin-token-guide,
.admin-token-hover-zone:focus .admin-token-guide {
  opacity: 1;
}

.admin-token-tooltip rect {
  fill: #173746;
  stroke: #ffffff;
  stroke-width: 1;
}

.admin-token-tooltip text {
  fill: #ffffff;
  font-size: 12px;
  font-weight: 700;
}

.admin-token-x-label,
.admin-token-y-label {
  fill: #647887;
  font-size: 12px;
}

.admin-operations-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(420px, 2fr);
  grid-auto-rows: auto;
  gap: 12px;
  align-items: start;
}

.admin-operations-grid > .panel {
  min-width: 0;
  height: auto;
  padding: 14px;
}

.admin-operations-grid .admin-server-panel {
  margin-top: 0 !important;
}

.admin-invitation-panel {
  display: block;
  min-height: 0;
}

.admin-operations-grid .admin-server-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.admin-operations-grid .admin-server-card {
  min-height: 74px;
  padding: 10px;
}

.admin-operations-grid .admin-server-card strong {
  font-size: 16px;
}

.admin-maintenance-details {
  margin-top: 10px;
  border-top: 1px solid var(--border);
}

.admin-maintenance-details .admin-maintenance-grid {
  margin-top: 10px;
}

.admin-invitation-list {
  display: grid;
  align-content: start;
  grid-auto-rows: max-content;
  gap: 8px;
  min-height: 0;
  max-height: 460px;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.admin-invitation-item {
  grid-template-columns: minmax(112px, 1fr) minmax(160px, 1.2fr) auto auto auto;
  gap: 8px;
  min-height: 42px;
  padding: 6px 8px;
}

.admin-invitation-code {
  overflow: hidden;
  font-size: 15px;
  letter-spacing: 1px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-invitation-remark-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.admin-invitation-remark {
  width: 100%;
  min-width: 0;
  height: 32px;
  padding: 4px 8px;
  font-size: 13px;
}

.admin-invitation-save-status {
  flex: 0 0 auto;
  min-width: 42px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.admin-invitation-item > span:not(.tag) {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.admin-invitation-item > span:nth-of-type(3) {
  display: none;
}

.admin-invitation-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: max-content;
}

.admin-invitation-actions .compact-btn {
  width: auto !important;
  min-width: 52px;
}

.admin-account-head {
  margin-bottom: 10px;
}

.admin-account-head #adminAccountSortSelect {
  width: 196px;
  min-width: 196px;
}

.admin-table-wrap {
  max-width: 100%;
  overflow: auto;
  scrollbar-gutter: stable;
}

.admin-table {
  min-width: 1420px;
}

.admin-table select.admin-compact-select {
  width: 124px !important;
  min-width: 124px !important;
  max-width: 124px !important;
  padding: 0 38px 0 12px !important;
  white-space: nowrap;
}

.admin-table th:nth-child(4),
.admin-table td:nth-child(4),
.admin-table th:nth-child(5),
.admin-table td:nth-child(5) {
  width: 144px !important;
  min-width: 144px !important;
}

.admin-table th,
.admin-table td {
  padding: 8px 10px;
  vertical-align: top;
}

.admin-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-soft);
}

.admin-account-table th,
.admin-account-table td {
  vertical-align: middle !important;
}

.admin-account-table .admin-email-cell {
  align-content: center !important;
  min-height: 58px;
}

.admin-account-name {
  display: grid;
  gap: 3px;
  min-width: 150px;
}

.admin-account-invitation {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
  overflow-wrap: anywhere;
}

.admin-usage-cell {
  min-width: 310px;
}

.admin-privacy-note {
  margin-top: 10px;
  padding: 9px 12px;
}

@media (max-width: 1280px) {
  .admin-stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  .admin-operations-grid {
    grid-template-columns: 1fr;
  }

  .admin-invitation-list {
    flex-basis: auto;
    max-height: 320px;
  }
}

@media (max-width: 760px) {
  .admin-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .admin-token-trend-panel .section-head {
    align-items: stretch;
  }

  .admin-token-forecast {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .admin-token-forecast > span {
    min-width: 0;
  }

  .admin-token-trend-chart {
    height: 160px;
  }

  .admin-operations-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-operations-grid .admin-server-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-invitation-item {
    grid-template-columns: minmax(0, 1fr) minmax(140px, 1fr);
  }

  .admin-invitation-remark-wrap {
    grid-column: 1 / -1;
  }

  .admin-invitation-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .topbar-actions .mobile-nav {
    min-width: 0;
    flex: 1 1 auto;
  }

  .topbar-actions .ghost-btn {
    width: auto;
    flex: 0 0 auto;
  }
}

/* Keep the authenticated sidebar fixed and structurally separate from the footer. */
body:has(.app-shell) .site-record-footer::before {
  content: none;
}

@media (min-width: 981px) {
  .app-shell {
    display: block !important;
  }

  .app-shell .sidebar {
    position: fixed !important;
    inset: 0 auto 0 0;
    width: 236px;
    height: 100vh !important;
    min-height: 100vh !important;
    z-index: 120;
  }

  .app-shell .main {
    margin-left: 236px;
    width: calc(100% - 236px);
  }

  body:has(.app-shell) .site-record-footer {
    margin-left: 236px;
    width: calc(100% - 236px);
  }
}

/* The longest quadrant label must remain visible beside the native arrow. */
.memo-todo-toolbar .compact-toolbar select {
  width: 150px !important;
  min-width: 150px !important;
  padding: 0 36px 0 12px !important;
}

.class-affairs-page { display:grid; gap:18px; }
.class-affairs-calendar-panel, .class-affairs-event-list-panel, .class-affairs-seating-panel, .class-affairs-forms-panel { overflow:hidden; }
.class-affairs-calendar-controls, .class-affairs-filter-row, .class-affairs-seat-actions, .class-affairs-seat-save { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.class-affairs-calendar-controls { justify-content:flex-end; }
.class-affairs-filter-row { margin:16px 0 10px; }
.class-affairs-month-picker { position:relative; }
.class-affairs-month-picker-popover { position:absolute; top:calc(100% + 8px); right:0; z-index:20; display:grid; grid-template-columns:repeat(2,minmax(100px,1fr)); gap:10px; min-width:260px; padding:12px; border:1px solid var(--line); border-radius:12px; background:var(--panel); box-shadow:0 12px 30px rgba(15,23,42,.16); }
.class-affairs-month-picker-popover[hidden] { display:none; }
.class-affairs-month-picker-popover label, .class-affairs-range-fields label { display:grid; gap:5px; color:var(--muted); font-size:13px; }
.class-affairs-month-picker-popover select { min-width:0; width:100%; }
.class-affairs-view-tabs { margin:0; }
.class-affairs-event-tabs { width:100%; }
.class-affairs-range-separator { padding-bottom:10px; color:var(--muted); }
.class-affairs-list-toolbar { display:grid; gap:14px; padding:14px; border:1px solid var(--line); border-radius:12px; background:color-mix(in srgb, var(--panel) 92%, var(--primary) 8%); }
.class-affairs-list-date-fields { display:flex; align-items:end; gap:10px; flex-wrap:wrap; }
.class-affairs-list-date-fields label { display:grid; gap:5px; flex:1 1 180px; color:var(--muted); font-size:13px; }
.class-affairs-list-date-fields input { width:100%; min-width:0; }
.class-affairs-list-type-tabs { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.segmented-control { display:flex; gap:6px; flex-wrap:wrap; }
.segmented-control button { border:1px solid var(--line); background:var(--panel); color:var(--muted); border-radius:999px; padding:8px 14px; cursor:pointer; }
.segmented-control button.active { background:var(--text); color:#fff; border-color:var(--text); }
.class-affairs-calendar-layout { display:grid; grid-template-columns:minmax(0,1.1fr) minmax(320px,.9fr); gap:18px; }
.class-affairs-calendar-week, .class-affairs-calendar-grid { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:4px; }
.class-affairs-calendar-week { color:var(--muted); text-align:center; font-size:13px; margin-bottom:6px; }
.class-affairs-calendar-cell { aspect-ratio:1 / 1; height:auto; min-height:0; border:1px solid var(--line); border-radius:8px; background:var(--panel); color:var(--text); padding:6px; text-align:left; cursor:pointer; position:relative; display:flex; flex-direction:column; align-items:flex-start; justify-content:flex-start; box-sizing:border-box; }
.class-affairs-calendar-cell > strong { position:relative; z-index:1; line-height:1.1; }
.class-affairs-calendar-cell.is-empty { visibility:hidden; }
.class-affairs-calendar-cell.is-selected { border-color:var(--primary); box-shadow:0 0 0 2px rgba(30,136,168,.18); }
.class-affairs-calendar-cell.is-today strong { color:var(--primary); }
.class-affairs-event-dot { position:absolute; left:7px; bottom:6px; display:block; width:7px; height:7px; border-radius:50%; background:var(--primary); margin:0; }
.class-affairs-event-list { border-left:1px solid var(--line); padding-left:18px; min-width:0; }
.class-affairs-event-list-standalone { border-left:0; border-top:1px solid var(--line); padding:18px 0 0; margin-top:16px; }
.class-affairs-event-list h4 { margin:0 0 10px; }
.class-affairs-event-row { display:flex; justify-content:space-between; gap:12px; padding:12px 0; border-bottom:1px solid var(--line); cursor:pointer; min-width:0; }
.class-affairs-event-row > div { min-width:0; display:grid; gap:5px; }
.class-affairs-event-row strong, .class-affairs-event-row p { overflow-wrap:anywhere; }
.class-affairs-event-row small { color:var(--muted); }
.class-affairs-event-row p { margin:0; color:var(--muted); font-size:13px; }
.class-affairs-seating-layout { display:grid; grid-template-columns:minmax(0,1.2fr) minmax(300px,.8fr); gap:22px; }
.class-affairs-seat-stage { background:color-mix(in srgb, var(--panel) 82%, var(--primary) 18%); border:1px solid var(--line); border-radius:16px; padding:18px; overflow:auto; }
.class-affairs-teacher-desk { text-align:center; background:var(--text); color:#fff; border-radius:9px; padding:8px; margin:0 auto 18px; max-width:240px; }
.class-affairs-seat-grid-wrap { min-width:620px; }
.class-affairs-seat-aisle-toolbar, .class-affairs-seat-grid { display:grid; grid-template-columns:var(--seat-grid-template); column-gap:8px; min-width:620px; }
.class-affairs-seat-aisle-toolbar { min-height:26px; align-items:center; overflow:visible; }
.class-affairs-seat-aisle-button { grid-row:1; justify-self:center; align-self:center; display:flex; align-items:center; justify-content:center; box-sizing:border-box; width:18px; min-width:18px; height:18px; padding:0; border:1px solid var(--line-strong); border-radius:50%; background:var(--panel); color:var(--primary); cursor:pointer; font-size:14px; line-height:1; }
.class-affairs-seat-aisle-button:hover, .class-affairs-seat-aisle-button:focus-visible { border-color:var(--primary); background:color-mix(in srgb, var(--panel) 82%, var(--primary) 18%); }
.class-affairs-seat-aisle-button.is-active { border-color:var(--primary); background:var(--primary); color:#fff; }
.class-affairs-seat-grid { row-gap:8px; }
.class-affairs-seat { min-height:70px; border:1px dashed var(--line-strong); border-radius:10px; background:var(--panel); color:var(--text); cursor:pointer; display:grid; place-content:center; gap:4px; text-align:center; }
.class-affairs-seat.is-filled { border-style:solid; border-color:var(--primary); background:color-mix(in srgb, var(--panel) 78%, var(--primary) 22%); }
.class-affairs-seat small { color:var(--muted); font-size:11px; }
.class-affairs-seat-aisle-space { min-width:0; width:100%; min-height:70px; pointer-events:none; border-radius:6px; background:transparent; }
.class-affairs-seat-aisle-space.is-active { background:color-mix(in srgb, var(--panel) 70%, var(--primary) 30%); }
.class-affairs-seat-tools { display:grid; gap:14px; min-width:0; }
.class-affairs-seat-settings { grid-template-columns:repeat(3,minmax(0,1fr)); }
.class-affairs-student-pool { display:flex; flex-wrap:wrap; gap:6px; max-height:none; overflow:visible; padding:4px 0; align-content:flex-start; }
.class-affairs-student-chip { display:inline-flex; align-items:center; justify-content:center; width:60px; min-height:42px; border:1px solid var(--line); border-radius:7px; background:var(--panel); padding:4px; color:var(--text); cursor:grab; text-align:center; line-height:1.2; font-size:13px; overflow-wrap:anywhere; box-shadow:0 1px 0 rgba(15,23,42,.04); touch-action:none; }
.class-affairs-student-chip:active, .class-affairs-student-chip.is-dragging { cursor:grabbing; }
.class-affairs-student-chip.is-dragging { opacity:.45; }
.class-affairs-seat.is-drag-over { border-color:var(--primary); background:color-mix(in srgb, var(--panel) 65%, var(--primary) 35%); box-shadow:0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent); }
.class-affairs-seat-drag-ghost { position:fixed; left:0; top:0; z-index:10000; display:flex; align-items:center; justify-content:center; width:68px; min-height:56px; box-sizing:border-box; padding:6px; border:2px solid var(--primary); border-radius:8px; background:color-mix(in srgb, var(--panel) 86%, var(--primary) 14%); color:var(--text); font-weight:700; line-height:1.3; text-align:center; overflow-wrap:anywhere; pointer-events:none; user-select:none; box-shadow:0 10px 24px rgba(15,23,42,.18); }
.class-affairs-seat-save-status { color:var(--primary); font-size:13px; font-weight:600; text-align:right; }
.class-affairs-history { display:grid; gap:6px; max-height:180px; overflow:auto; }
.class-affairs-history > div { display:flex; justify-content:space-between; gap:8px; border-bottom:1px solid var(--line); padding:6px 0; }
.class-affairs-forms-panel .generic-forms-page { padding:0; }
.class-affairs-forms-panel .generic-forms-embedded .generic-forms-layout { display:grid; grid-template-columns:1fr; gap:16px; }
.class-affairs-forms-panel .generic-forms-embedded .generic-form-sidebar { width:100%; overflow:hidden; }
.class-affairs-forms-panel .generic-forms-embedded .generic-form-list { display:flex; gap:10px; overflow-x:auto; overflow-y:hidden; padding:2px 2px 12px; scroll-snap-type:x proximity; scrollbar-width:thin; }
.class-affairs-forms-panel .generic-forms-embedded .generic-form-tab { flex:0 0 min(280px, 78vw); min-height:82px; scroll-snap-align:start; }
.class-affairs-forms-panel .generic-forms-embedded .generic-form-main { width:100%; }
@media (max-width: 900px) {
  .class-affairs-calendar-layout, .class-affairs-seating-layout { grid-template-columns:1fr; }
  .class-affairs-event-list { border-left:0; border-top:1px solid var(--line); padding:18px 0 0; }
}

/* Class affairs: four peer panels, explicit ranges, and dense responsive event cards. */
.class-affairs-panel-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 92%, var(--primary) 8%);
}
.class-affairs-panel-tabs button {
  min-width: 0;
  border-radius: 8px;
  white-space: nowrap;
}
.class-affairs-panel-tabs button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.class-affairs-list-date-fields {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto minmax(150px, 1fr) minmax(360px, 2fr);
  align-items: end;
  gap: 10px;
}
.class-affairs-list-date-fields input {
  height: var(--ui-control-compact);
  min-height: var(--ui-control-compact);
  padding: 0 10px;
  box-sizing: border-box;
}
.class-affairs-list-date-fields label {
  min-width: 0;
  width: auto;
}
.class-affairs-list-range-area {
  min-width: 0;
}
.class-affairs-list-range-buttons {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.class-affairs-list-range-buttons button {
  min-width: 0;
  min-height: 42px;
  padding: 6px 10px;
  line-height: 1.2;
}
.class-affairs-list-range-buttons button.active {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--panel) 78%, var(--primary) 22%);
  color: var(--primary-dark);
}
.class-affairs-list-range-buttons small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
}
.class-affairs-event-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}
.class-affairs-event-grid .class-affairs-event-row {
  min-height: 154px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: 10px;
  background: var(--panel);
}
.class-affairs-event-grid .class-affairs-event-row > div {
  flex: 1;
}
.class-affairs-event-grid .class-affairs-event-row strong,
.class-affairs-event-grid .class-affairs-event-row p {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}
.class-affairs-event-grid .class-affairs-event-row p {
  max-height: 3.9em;
}
.class-affairs-event-grid .class-affairs-event-row > button {
  align-self: flex-end;
}
.generic-sheet-wrap {
  max-width: 100%;
  overflow-x: auto;
}
.generic-sheet {
  width: 100%;
  min-width: 100%;
  table-layout: auto;
}
.generic-form-date-filter-toolbar {
  margin: 0 0 14px;
}
@media (max-width: 1500px) {
  .class-affairs-event-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .class-affairs-event-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .class-affairs-list-date-fields { grid-template-columns: minmax(140px, 1fr) auto minmax(140px, 1fr); }
  .class-affairs-list-range-area { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .class-affairs-panel-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .class-affairs-list-date-fields { grid-template-columns: 1fr; }
  .class-affairs-range-separator { display: none; }
  .class-affairs-list-range-area { grid-column: auto; }
  .class-affairs-list-range-buttons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .class-affairs-event-grid { grid-template-columns: 1fr; }
}
