/* Same data and actions; phone composition prioritizes the task in hand. */
.mobile-schedule-controls,
.mobile-menu-actions,
.directory-filter-toggle,
.mobile-lesson-back {
  display: none;
}
.directory-filter-fields {
  display: contents;
}
@media (max-width: 700px) {
  body #main {
    padding: 12px 12px 24px;
  }
  body .schedule-page .schedule-tools {
    margin-bottom: 8px;
  }
  body .schedule-page .schedule-command .teacher-strip {
    display: none;
  }
  body .schedule-page .schedule-command {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    padding: 0;
    min-height: 44px;
    border: 0;
  }
  body .schedule-command h1,
  body .schedule-command > .view-picker,
  body .schedule-command > .tool-pop-trigger {
    display: none;
  }
  body .schedule-command .week-nav {
    flex: 1;
    width: auto;
    margin: 0;
    flex-wrap: nowrap;
    gap: 0;
  }
  body .schedule-command .week-nav strong {
    font-size: 16px;
    white-space: nowrap;
  }
  body .schedule-command .week-nav button {
    width: 40px;
    min-width: 40px;
    min-height: 44px;
    padding: 8px;
  }
  body .schedule-command .command-actions {
    flex: none;
    width: auto;
    margin: 0;
  }
  body
    .schedule-command
    .command-actions
    > :not(.more-trigger):not(.tool-popover) {
    display: none;
  }
  body .schedule-command .more-trigger {
    width: 44px;
    min-height: 44px;
    padding: 10px;
  }
  body .mobile-schedule-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin: 6px 0 8px;
  }
  body .mobile-schedule-controls > button {
    display: flex;
    align-items: center;
    gap: 5px;
    min-height: 44px;
    padding: 8px 12px;
    font-size: 13px;
  }
  body .mobile-view-switch {
    display: flex;
    background: var(--jj-gray-150);
    padding: 3px;
    border-radius: var(--jj-radius-card);
  }
  body .mobile-view-switch button {
    min-height: 38px;
    border: 0;
    background: transparent;
    padding: 6px 18px;
    font-size: 14px;
  }
  body .mobile-view-switch [aria-pressed="true"] {
    color: var(--jj-primary);
    background: white;
    box-shadow: 0 1px 4px #24344f12;
  }
  body .schedule-page[data-mobile-filters="false"] .schedule-filterline {
    display: none;
  }
  body .schedule-page[data-mobile-filters="true"] .schedule-filterline {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 10px;
    background: white;
    border: 1px solid var(--jj-gray-200);
    border-radius: var(--jj-radius-card);
    gap: 8px;
  }
  body .schedule-filterline .teacher-strip {
    width: 100%;
    min-width: 0;
  }
  body .schedule-filterline .teacher-shortcuts {
    gap: 4px;
  }
  body .schedule-filterline .teacher-shortcuts button {
    font-size: 13px;
    min-height: 44px;
    padding: 8px 10px;
  }
  body .schedule-filterline .schedule-filters {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 6px;
  }
  body .schedule-page[data-mobile-layout="day"] .board-controls,
  body .schedule-page[data-mobile-layout="day"] .time-trigger {
    display: none;
  }
  body .schedule-page[data-mobile-layout="day"] .board-scroll {
    display: none !important;
  }
  body .schedule-page[data-mobile-layout="day"] .mobile-agenda {
    display: block !important;
  }
  body .schedule-page[data-mobile-layout="week"] .board-scroll {
    display: block !important;
  }
  body .schedule-page[data-mobile-layout="week"] .mobile-agenda {
    display: none !important;
  }
  body .schedule-page .board-layout,
  body .schedule-page .board-main {
    min-height: 0;
    height: auto;
    display: block;
  }
  body .schedule-page .mobile-agenda .day-switch {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 4;
    gap: 2px;
    padding: 6px 0;
    background: var(--jj-gray-50);
    margin: 0;
  }
  body .mobile-agenda .day-switch button {
    flex: 1;
    padding: 6px 0;
    min-width: 0;
    min-height: 44px;
    font-size: 14px;
    border-color: transparent;
    background: transparent;
  }
  body .mobile-agenda .day-switch button.active {
    background: var(--jj-primary);
    color: white;
    border-radius: var(--jj-radius-card);
  }
  body .mobile-agenda section {
    margin: 12px 0 20px;
  }
  body .mobile-agenda h3 {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 0 2px 8px;
    color: var(--jj-gray-800);
    font-size: 15px;
  }
  body .mobile-agenda h3 span {
    color: var(--jj-gray-600);
    font-size: 12px;
    font-weight: 500;
  }
  body .mobile-agenda .class-card {
    height: auto;
    min-height: 0;
    margin: 0 0 8px;
    padding: 10px 12px;
    border-radius: var(--jj-radius-card);
    background: white;
  }
  body .mobile-agenda .class-open {
    min-height: 36px;
    font-size: 15px;
    width: 100%;
    padding-right: 0;
  }
  body .mobile-agenda .class-open strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  body .mobile-agenda .class-open > span {
    font-size: 12px;
    flex: none;
  }
  body .mobile-agenda .class-pencil {
    display: none;
  }
  body .mobile-agenda .class-meta {
    white-space: normal;
    font-size: 12px;
    line-height: 1.5;
    margin: 2px 0 6px;
  }
  body .mobile-agenda .student-chips {
    height: auto;
    min-height: 0;
    flex-wrap: wrap;
    gap: 5px;
  }
  body .mobile-agenda .student-chips button {
    min-height: 36px;
    padding: 5px 8px;
    font-size: 13px;
  }
  html body.has-utility-dock .planbar,
  body .planbar {
    margin-top: 12px;
    height: auto;
    padding: 4px 0;
  }
  body .plan-tabs {
    overflow-x: auto;
    max-width: 100%;
  }
  body .plan-tabs button {
    min-height: 40px;
    padding: 6px 12px;
    font-size: 12px;
  }
  body .mobile-menu-actions {
    display: grid;
  }
  body .board-scroll .master-table .time-col {
    width: 42px;
    min-width: 42px;
    font-size: 11px;
  }
  body .board-scroll .master-table .teacher-col {
    left: 42px;
    width: 70px;
    min-width: 70px;
    font-size: 11px;
  }
  body .board-scroll .teacher-property-link {
    font-size: 11px;
    padding: 4px;
  }
  body .board-scroll .teacher-mark {
    flex: none;
    width: 3px;
    margin-right: 3px;
  }
  body .students-page {
    padding: 8px 0 18px;
  }
  body .students-heading {
    margin-bottom: 12px;
    justify-content: space-between;
  }
  body .students-heading h1 {
    font-size: 22px;
  }
  body .students-heading p {
    font-size: 12px;
  }
  body .directory-filters {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
  }
  body .directory-search {
    grid-column: auto;
    font-size: 0;
    gap: 0;
  }
  body .directory-search input {
    height: 44px;
    font-size: 15px;
  }
  body .directory-filter-toggle {
    display: flex;
    gap: 5px;
    align-items: center;
    height: 44px;
    font-size: 12px;
    padding: 6px 10px;
  }
  body .directory-filter-fields {
    grid-column: 1/-1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 10px;
    background: #fff;
    border: 1px solid var(--jj-gray-200);
    border-radius: var(--jj-radius-card);
  }
  body .directory-filter-fields[data-expanded="false"] {
    display: none;
  }
  body .directory-filter-fields :is(select, button) {
    min-height: 44px;
  }
  body .directory-result {
    font-size: 12px;
    margin: 10px 0;
  }
  body .directory-table tr {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 3px 8px;
    padding: 10px 12px;
    align-items: center;
  }
  body .directory-table td {
    display: block;
    padding: 0;
    border: 0;
    font-size: 12px;
    text-align: left;
  }
  body .directory-table td::before {
    display: none;
  }
  body .directory-table td:first-child {
    grid-column: 1/3;
    grid-row: 1;
  }
  body .directory-table td:first-child button {
    display: block;
    min-height: 32px;
    padding: 0;
    text-align: left;
    font-size: 15px;
    width: 100%;
  }
  body .directory-table td[data-label="상태"] {
    grid-column: 3;
    grid-row: 1;
  }
  body .directory-table td[data-label="학교"] {
    grid-column: 2;
    grid-row: 2;
  }
  body .directory-table td[data-label="학년"] {
    grid-column: 1;
    grid-row: 2;
  }
  body .directory-table td[data-label="이번 주 수업"] {
    grid-column: 3;
    grid-row: 2;
    color: var(--jj-gray-600);
  }
  body .student-detail-navigation {
    margin-bottom: 12px;
    gap: 6px;
  }
  body .student-detail-navigation button {
    font-size: 12px;
    padding: 6px 8px;
    min-height: 40px;
  }
  body .student-detail-tabs {
    gap: 0;
    margin: 12px 0;
  }
  body .student-detail-tabs button {
    font-size: 13px;
    min-width: 0;
    flex: 1;
    padding: 10px 4px;
  }
  body .student-detail-card {
    padding: 14px;
  }
  body .student-detail-card h2 {
    font-size: 17px;
  }
  body .student-detail-card label {
    font-size: 13px;
  }
  body
    .mobile-lesson-workspace[data-mobile-editing="false"]
    .server-lesson-editor {
    display: none;
  }
  body
    .mobile-lesson-workspace[data-mobile-editing="true"]
    > :not(.server-lessons-layout) {
    display: none;
  }
  body
    .mobile-lesson-workspace[data-mobile-editing="true"]
    .server-lesson-list {
    display: none;
  }
  body .mobile-lesson-workspace .server-lessons-layout {
    display: block;
    height: auto;
    min-height: 0;
  }
  body .mobile-lesson-workspace .server-lesson-list {
    max-height: none;
    height: auto;
    overflow: visible;
  }
  body .mobile-lesson-workspace .server-lesson-editor {
    position: static !important;
    height: auto;
    max-height: none;
    width: auto;
    margin: 0;
    padding: 14px;
    box-shadow: none;
    overflow: visible;
  }
  body .mobile-lesson-workspace .mobile-lesson-back {
    display: inline-flex;
    gap: 5px;
    align-items: center;
    min-height: 44px;
    margin: 0 0 8px;
  }
  body .mobile-lesson-workspace .server-lesson-row {
    padding: 12px;
    gap: 4px;
    border-radius: 0;
  }
  body .mobile-lesson-workspace .server-lesson-row strong {
    font-size: 15px;
  }
  body .mobile-lesson-workspace .server-lesson-row small {
    font-size: 12px;
  }
  body .mobile-lesson-workspace .server-lesson-actions {
    position: sticky;
    top: 0;
    z-index: 2;
    background: white;
    padding: 8px 0;
    margin-bottom: 12px;
  }
  body .mobile-lesson-workspace .server-lesson-actions button {
    min-height: 44px;
    font-size: 13px;
  }
  body .mobile-lesson-workspace .server-lesson-form h2 {
    font-size: 18px;
  }
  body .mobile-lesson-workspace .ops-filters {
    gap: 8px;
    margin-bottom: 10px;
  }
  body .mobile-lesson-workspace .lesson-days {
    margin-bottom: 12px;
  }
  body.mobile-chat-open {
    overflow: hidden;
  }
  body #jjbot-panel {
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  body #jjbot-panel > header {
    min-height: 44px;
    padding: 2px 10px;
  }
  body #jjbot-panel > header [data-bot-maximize] {
    display: none;
  }
  body #jjbot-panel .jjbot-channels {
    padding: 0 12px;
  }
  body #jjbot-panel .jjbot-channels button {
    min-height: 44px;
    font-size: 13px;
  }
  body #jjbot-panel .jjbot-commandbar {
    padding: 0 8px;
    min-height: 44px;
  }
  body #jjbot-panel .jjbot-commandbar button {
    min-height: 40px;
    min-width: 40px;
  }
  body #jjbot-panel .jjbot-room-heading {
    position: static;
  }
  body #jjbot-panel .jjbot-body {
    padding: 12px;
  }
  body #jjbot-panel .jjbot-room-list .jjbot-thread {
    padding: 10px 4px;
    min-height: 72px;
  }
  body #jjbot-panel .jjbot-compose {
    padding: 8px 10px;
  }
  body #jjbot-panel textarea {
    min-height: 42px;
    max-height: 100px;
    font-size: 15px;
  }
  body #jjbot-panel .jjbot-menu {
    top: 132px;
  }
  body .attendance-empty {
    padding: 22px 14px;
    min-height: 150px;
  }
  body .attendance-empty-icon {
    width: 40px;
    height: 40px;
    margin-bottom: 10px;
  }
  body .attendance-empty h3 {
    font-size: 15px;
  }
  body .attendance-empty p {
    font-size: 12px;
    line-height: 1.5;
    margin: 5px 0;
  }
  body .video-intro {
    padding: 12px 0;
  }
  body .video-intro h1 {
    font-size: 22px;
  }
  body .video-intro p {
    font-size: 12px;
  }
}
@media (max-width: 700px) {
  body .fm-header {
    padding: 12px 14px;
  }
  body .fm-header h2 {
    font-size: 19px;
  }
  body .fm-header p {
    display: none;
  }
  body .fm-header img {
    width: 32px;
    height: 32px;
  }
}
@media (max-width: 700px) {
  html body.has-utility-dock .planbar,
  body .planbar {
    position: static;
    width: auto;
    height: auto;
    z-index: auto;
    margin: 12px 0;
    border-top: 0;
    background: transparent;
  }
  body .mobile-agenda .class-open,
  body .mobile-agenda .student-chips button {
    min-height: 44px;
  }
  body .directory-table td:first-child button {
    min-height: 36px;
  }
}

/* Mobile timetable v2: overview first, details on demand. */
.ms-controls,
.ms-schedule {
  display: none;
}
.ms-sheet {
  width: min(560px, calc(100vw - 20px));
  max-height: min(88dvh, 850px);
  padding: 0;
  border: 1px solid var(--jj-gray-200);
  border-radius: var(--jj-radius-sheet);
  color: var(--jj-gray-800);
  background: #fff;
  box-shadow: 0 24px 80px #172e5a26;
}
.ms-sheet::backdrop {
  background: #14233f66;
}
.ms-sheet > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--jj-gray-150);
  position: sticky;
  top: 0;
  background: white;
  z-index: 2;
}
.ms-sheet h2 {
  font-size: 19px;
  margin: 0;
}
.ms-sheet button {
  min-height: 44px;
}
.ms-sheet [data-ms-close] {
  padding: 10px;
  border: 0;
  background: var(--jj-gray-100);
  border-radius: 50%;
  width: 44px;
}
.ms-sheet-search {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 16px;
  padding: 0 12px;
  border: 1px solid var(--jj-gray-300);
  border-radius: var(--jj-radius-card);
}
.ms-sheet-search input {
  border: 0;
  background: transparent;
  width: 100%;
  min-width: 0;
  padding: 12px 0;
  font: inherit;
}
.ms-sheet-search input:focus {
  outline: none;
}
.ms-sheet-search:focus-within {
  outline: 2px solid var(--jj-primary);
}
.ms-sheet-search svg {
  width: 20px;
  flex: none;
}
.ms-sheet-list {
  padding: 0 16px 16px;
}
.ms-sheet .ms-teacher-option {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--jj-gray-150);
  min-height: 60px;
  gap: 10px;
}
.ms-sheet .ms-teacher-option[hidden] {
  display: none;
}
.ms-teacher-option button {
  border: 0;
  background: transparent;
  padding: 10px;
}
.ms-teacher-option [data-ms-pick] {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  text-align: left;
}
.ms-teacher-option i {
  width: 10px;
  height: 28px;
  border-radius: 4px;
  flex: none;
}
.ms-teacher-option [aria-pressed="true"] {
  color: var(--jj-primary);
  background: var(--jj-primary-50);
  border-radius: var(--jj-radius-control);
}
.ms-sheet footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  color: var(--jj-gray-600);
  background: var(--jj-gray-50);
  font-size: 12px;
}
.ms-sheet svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  flex: none;
}
.ms-class-list {
  padding-top: 12px;
}
.ms-class-list .class-card {
  height: auto;
  margin-bottom: 10px;
}
.ms-class-list .class-open {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-width: 0;
}
.ms-class-list .class-open strong {
  white-space: normal;
  overflow-wrap: anywhere;
}
.ms-class-list .class-meta {
  white-space: normal;
}
.ms-class-list .class-pencil {
  display: none;
}
.ms-class-list .student-chips {
  height: auto;
  flex-wrap: wrap;
}
@media (max-width: 700px) {
  body .schedule-page .board-scroll,
  body.board-focus .schedule-page .board-scroll {
    display: none !important;
  }
  body .schedule-page .schedule-filterline .teacher-strip,
  body .schedule-page .schedule-filterline .board-controls {
    display: none !important;
  }
  body .schedule-page .schedule-filterline .schedule-filters {
    gap: 6px;
  }
  body .schedule-page .schedule-filterline .time-trigger {
    display: flex;
  }
  body .schedule-page .ms-controls {
    display: block;
    margin-top: 4px;
  }
  body .ms-primary {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  body .ms-primary .mobile-view-switch {
    margin-right: auto;
  }
  body .ms-primary .mobile-view-switch button {
    padding: 6px 14px;
    min-height: 38px;
    font-size: 13px;
  }
  body .ms-primary > button {
    min-height: 44px;
    padding: 8px;
    border: 0;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    white-space: nowrap;
  }
  body .ms-primary > button.active {
    color: var(--jj-primary);
    background: var(--jj-primary-50);
  }
  body .ms-primary svg {
    width: 18px;
    height: 18px;
  }
  body .ms-now {
    color: var(--jj-primary);
  }
  body .ms-teachers {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    padding: 6px 0;
    border-bottom: 1px solid var(--jj-gray-200);
  }
  body .ms-teachers button {
    display: flex;
    gap: 5px;
    align-items: center;
    min-height: 44px;
    padding: 8px 10px;
    border: 0;
    flex: none;
    border-radius: var(--jj-radius-control);
    background: transparent;
    font-size: 13px;
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
  }
  body .ms-teachers .ms-teacher-picker {
    padding: 6px;
    width: 40px;
  }
  body .ms-teacher-picker img {
    display: block;
    object-fit: contain;
  }
  body .ms-teachers .ms-all {
    padding: 8px;
  }
  body .ms-teacher-scroll {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 3px;
    min-width: 0;
    overscroll-behavior-x: contain;
  }
  body .ms-teachers [aria-pressed="true"] {
    background: var(--jj-primary-50);
    color: var(--jj-primary-hover);
    font-weight: 700;
  }
  body .ms-teachers i {
    background: var(--teacher);
    width: 5px;
    height: 15px;
    border-radius: 3px;
    flex: none;
  }
  body .ms-teachers .ms-pinned {
    background: #fff;
    border: 1px solid var(--jj-primary-200);
    max-width: 126px;
  }
  body .ms-pinned span {
    overflow: hidden;
    text-overflow: ellipsis;
  }
  body .ms-teachers svg {
    width: 12px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
  }
  body .ms-view-tools {
    display: flex;
    align-items: center;
    gap: 2px;
    min-height: 46px;
  }
  body .ms-view-tools button {
    min-height: 44px;
    border: 0;
    background: transparent;
    padding: 6px 8px;
    font-size: 12px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
  }
  body .ms-view-tools > button:first-child {
    padding-left: 0;
    margin-right: auto;
  }
  body .ms-view-tools svg {
    width: 17px;
    height: 17px;
  }
  body .ms-zoom {
    display: flex;
    align-items: center;
  }
  body .ms-zoom button {
    min-width: 32px;
    font-size: 21px;
    padding: 5px;
  }
  body .ms-zoom .ms-zoom-value {
    font-size: 12px;
    min-width: 46px;
    font-variant-numeric: tabular-nums;
    color: var(--jj-gray-700);
  }
  body .ms-view-tools .ms-full {
    width: 38px;
    padding: 6px;
  }
  body .ms-view-tools .ms-full svg {
    width: 20px;
    height: 20px;
  }
  body .ms-schedule {
    display: block;
    overflow: auto;
    overscroll-behavior: contain;
    min-height: 220px;
    height: 450px;
    position: relative;
    border: 1px solid var(--jj-gray-200);
    border-radius: var(--jj-radius-card);
    background: white;
    scrollbar-width: thin;
    touch-action: pan-x pan-y;
  }
  body .ms-schedule-content {
    width: max(100%, calc(var(--ms-base-width) * var(--ms-scale)));
    min-width: 100%;
    position: relative;
  }
  body .ms-days {
    display: grid;
    grid-template-columns: repeat(var(--ms-days), minmax(0, 1fr));
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 3;
    border-bottom: 1px solid var(--jj-gray-200);
  }
  body .ms-days button {
    min-width: 0;
    min-height: 44px;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 8px 0;
    font-size: 13px;
    color: var(--jj-gray-600);
  }
  body .ms-days [aria-current="date"] {
    color: var(--jj-primary);
    font-weight: 700;
    box-shadow: inset 0 -3px var(--jj-primary);
  }
  body .ms-days .active {
    background: var(--jj-primary-50);
    color: var(--jj-primary);
    font-weight: 700;
  }
  body .ms-time-group {
    margin: 0;
  }
  body .ms-time-group h3 {
    margin: 0;
  }
  body .ms-time-group h3 button {
    display: flex;
    align-items: center;
    width: 100%;
    text-align: left;
    gap: 8px;
    min-height: 44px;
    padding: 7px 12px;
    border: 0;
    border-top: 1px solid var(--jj-gray-200);
    border-radius: 0;
    background: var(--jj-gray-50);
  }
  body .ms-time-group h3 time {
    font-size: 14px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
  }
  body .ms-time-group h3 span {
    font-size: 11px;
    font-weight: 500;
    color: var(--jj-gray-600);
  }
  body .ms-time-group h3 em {
    font-style: normal;
    font-size: 10px;
    color: var(--jj-primary);
    background: var(--jj-primary-100);
    padding: 2px 5px;
    border-radius: 4px;
  }
  body .ms-time-group h3 svg {
    width: 17px;
    height: 17px;
    margin-left: auto;
    fill: none;
    stroke: var(--jj-gray-600);
    stroke-width: 1.8;
  }
  body .ms-time-group h3 [aria-expanded="false"] svg {
    transform: rotate(-90deg);
  }
  body .ms-empty {
    padding: 48px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
  }
  body .ms-empty svg {
    width: 32px;
    height: 32px;
    color: var(--jj-gray-400);
  }
  body .ms-empty span {
    font-size: 13px;
    color: var(--jj-gray-600);
  }
  body .ms-day-view .ms-time-content {
    padding: 8px;
  }
  body .ms-day-view .class-card {
    height: auto;
    min-height: 0;
    margin: 0 0 8px;
    padding: 10px 12px;
    border-radius: var(--jj-radius-card);
  }
  body .ms-day-view .class-open {
    display: flex;
    justify-content: space-between;
    width: 100%;
    min-height: 40px;
    font-size: 15px;
    gap: 10px;
  }
  body .ms-day-view .class-open strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  body .ms-day-view .class-open > span {
    flex: none;
    font-size: 12px;
  }
  body .ms-day-view .class-pencil {
    display: none;
  }
  body .ms-day-view .class-meta {
    white-space: normal;
    font-size: 12px;
    margin: 2px 0 6px;
    line-height: 1.5;
  }
  body .ms-day-view .student-chips {
    height: auto;
    flex-wrap: wrap;
    gap: 5px;
  }
  body .ms-day-view .student-chips button {
    min-height: 40px;
    font-size: 13px;
    padding: 6px 8px;
  }
  body .ms-day-view .class-card .student-chips {
    touch-action: manipulation;
  }
  body .ms-day-view .class-card .student-chips button.more {
    min-width: 56px;
    min-height: 40px;
    font-weight: 700;
    font-size: 14px;
    color: var(--accent);
  }
  body .ms-day-view .class-card.roster-expanded .student-chips {
    gap: 6px;
  }
  body
    .ms-day-view
    .class-card.roster-expanded
    .student-chips
    button:not(.more) {
    min-height: 40px;
    max-width: 100%;
  }
  body .ms-day-view .class-open {
    padding-right: 34px;
  }
  body .ms-day-view .class-add-student {
    top: 6px;
    right: 6px;
    width: 32px;
    min-height: 32px;
  }
  body .ms-roster-tools {
    display: flex;
    padding: 0 0 6px;
  }
  body .ms-roster-tools .roster-toggle {
    flex: 1;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid var(--jj-gray-300);
    border-radius: var(--jj-radius-pill);
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    color: var(--jj-gray-700);
  }
  body .ms-roster-tools .roster-toggle span {
    display: inline;
  }
  body .ms-roster-tools .roster-toggle svg {
    width: 17px;
    height: 17px;
  }
  body .ms-roster-tools .roster-toggle[aria-pressed="true"] {
    background: var(--jj-primary-50, #eef2ff);
    border-color: var(--accent);
    color: var(--accent);
  }
  body .ms-sheet {
    margin: auto auto 0;
    width: 100%;
    max-width: 100%;
    max-height: 85dvh;
    border-radius: 22px 22px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  body.board-focus #jj-utility-dock,
  body.board-focus .planbar {
    display: none !important;
  }
  body.board-focus #main {
    padding: 4px 8px 8px;
  }
  body.board-focus .ms-schedule {
    border-radius: var(--jj-radius-control);
  }
}
@media (prefers-reduced-motion: no-preference) {
  .ms-teachers button,
  .ms-cell {
    transition:
      background-color 0.16s ease,
      color 0.16s ease;
  }
  .ms-time-group h3 svg {
    transition: transform 0.18s ease;
  }
  .ms-time-content:not([hidden]) {
    animation: ms-reveal 0.16s ease-out;
  }
  .ms-sheet[open] {
    animation: ms-sheet-in 0.2s ease-out;
  }
  @keyframes ms-reveal {
    from {
      opacity: 0.45;
      transform: translateY(-3px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }
  @keyframes ms-sheet-in {
    from {
      opacity: 0.5;
      transform: translateY(18px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }
}
@media (max-width: 700px) {
  body .schedule-page[data-mobile-layout="week"] .board-scroll,
  body .schedule-page[data-mobile-layout="day"] .board-scroll {
    display: none !important;
  }
  body .ms-full span {
    display: none;
  }
}
@media (max-width: 700px) {
  body .ms-earlier > summary {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    color: var(--jj-gray-600);
    background: var(--jj-gray-50);
    font-size: 12px;
    list-style: none;
    cursor: pointer;
  }
  body .ms-earlier > summary::-webkit-details-marker {
    display: none;
  }
  body .ms-earlier > summary svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
  }
  body .ms-earlier > summary svg:last-child {
    margin-left: auto;
  }
}
@media (max-width: 700px) {
  body .ms-personal-cell strong {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    white-space: normal;
  }
}

/* Keep every class and teacher visible: zoom changes the grid, never its content. */
@media (max-width: 700px) {
  body .ms-grid-head,
  body .ms-teacher-row {
    display: grid;
    grid-template-columns: calc(86px * var(--ms-scale)) repeat(
        var(--ms-days),
        minmax(0, 1fr)
      );
  }
  body .ms-grid-head button {
    font-size: calc(13px * var(--ms-scale));
    min-height: max(28px, calc(38px * var(--ms-scale)));
  }
  body .ms-teacher-heading,
  body .ms-row-name {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--jj-gray-50);
    border-right: 1px solid var(--jj-gray-200);
    display: flex;
    align-items: center;
    gap: calc(6px * var(--ms-scale));
    padding: calc(9px * var(--ms-scale));
    font-size: calc(12px * var(--ms-scale));
    font-weight: 700;
    text-align: left;
    min-width: 0;
    overflow-wrap: anywhere;
  }
  body .ms-teacher-heading {
    z-index: 4;
    justify-content: center;
    color: var(--jj-gray-600);
  }
  body .ms-row-name i {
    width: calc(3px * var(--ms-scale));
    height: calc(25px * var(--ms-scale));
    background: var(--teacher);
    border-radius: 3px;
    flex-shrink: 0;
  }
  body .ms-row-name small {
    display: block;
    font-size: calc(9px * var(--ms-scale));
    font-weight: 500;
    color: var(--jj-gray-500);
    margin-top: calc(3px * var(--ms-scale));
  }
  body .ms-teacher-row {
    border-bottom: 1px solid var(--jj-gray-200);
  }
  body .ms-grid-cell {
    min-width: 0;
    border-right: 1px solid var(--jj-gray-200);
    padding: calc(4px * var(--ms-scale));
    display: flex;
    flex-direction: column;
    gap: calc(4px * var(--ms-scale));
  }
  body .ms-class {
    width: 100%;
    min-width: 0;
    min-height: calc(72px * var(--ms-scale));
    padding: calc(8px * var(--ms-scale));
    border: 1px solid var(--jj-gray-200);
    border-left: calc(3px * var(--ms-scale)) solid var(--teacher);
    border-radius: calc(7px * var(--ms-scale));
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: calc(6px * var(--ms-scale));
    text-align: left;
    background: var(--jj-gray-50);
    color: var(--jj-gray-900);
    white-space: normal;
  }
  body .ms-class strong {
    font-size: calc(13px * var(--ms-scale));
    line-height: 1.4;
    font-weight: 700;
    overflow-wrap: anywhere;
  }
  body .ms-class:active {
    background: var(--jj-primary-50);
  }
  body .ms-class-names {
    color: var(--jj-gray-800);
    font-size: calc(11px * var(--ms-scale));
    line-height: 1.45;
    font-weight: 500;
    overflow-wrap: anywhere;
  }
  body .ms-class-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: calc(3px * var(--ms-scale));
    color: var(--jj-gray-600);
    font-size: calc(10px * var(--ms-scale));
    line-height: 1.4;
  }
  body .ms-class-meta svg {
    width: calc(11px * var(--ms-scale));
    height: calc(11px * var(--ms-scale));
  }
  body .ms-class-meta > span {
    flex-basis: 100%;
  }
  body .ms-class-teacher {
    font-size: calc(10px * var(--ms-scale));
    font-weight: 600;
    color: var(--teacher);
  }
  body .ms-grid-empty {
    display: grid;
    flex: 1;
    place-items: center;
    min-height: calc(72px * var(--ms-scale));
    color: var(--jj-gray-300);
    font-size: calc(12px * var(--ms-scale));
  }
  body .ms-time-group h3 {
    position: sticky;
    left: 0;
    width: var(--ms-viewport, 100%);
  }
  body .ms-day-view .ms-schedule-content {
    width: 100%;
  }
}
@media (max-width: 700px) {
  body .ms-row-name .teacher-location {
    font-size: calc(9px * var(--ms-scale));
    font-weight: 400;
    line-height: 1.5;
    margin-top: calc(5px * var(--ms-scale));
  }
  body .ms-class-teacher .teacher-location {
    font-size: calc(9px * var(--ms-scale));
  }
  body .ms-location-exception {
    font-size: calc(9px * var(--ms-scale));
    line-height: 1.4;
    color: var(--jj-warning-fg);
    background: var(--jj-warning-bg);
    border-radius: calc(4px * var(--ms-scale));
    padding: calc(2px * var(--ms-scale)) calc(4px * var(--ms-scale));
  }
  body .ms-day-view .schedule-teacher-locations {
    position: sticky;
    left: 0;
    gap: 16px;
  }
}
/* 학생 펼치기·접기: '모두 접기' 옆에 작게 (따로 한 줄을 차지하지 않아요). */
@media (max-width: 700px) {
  body .ms-view-tools .ms-roster-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 34px;
    padding: 0 10px;
    border: 0;
    border-radius: 999px;
    background: var(--jj-surface-subtle, var(--jj-gray-50));
    box-shadow: inset 0 0 0 1px var(--jj-border);
    font-size: 12.5px;
    font-weight: 700;
    color: var(--jj-text-secondary);
    white-space: nowrap;
  }
  body .ms-view-tools .ms-roster-chip svg {
    width: 15px;
    height: 15px;
  }
  body .ms-view-tools .ms-roster-chip[aria-pressed="true"] {
    background: var(--jj-primary-50);
    box-shadow: inset 0 0 0 1px var(--jj-primary-200);
    color: var(--jj-primary);
  }
  body .ms-roster-tools {
    display: none;
  }
  /* 전체 화면: 시간표만. 오른쪽 아래 작은 버튼으로 확대·나가기. */
  body.board-focus .schedule-command,
  body.board-focus .ms-primary,
  body.board-focus .ms-teachers,
  body.board-focus .schedule-filterline,
  body.board-focus .ms-view-tools > [data-ms="collapse-all"],
  body.board-focus .ms-view-tools > .ms-roster-chip,
  body.board-focus .ms-view-tools > .ms-fit {
    display: none !important;
  }
  body.board-focus .ms-controls {
    padding: 0;
    margin: 0;
    border: 0;
  }
  body.board-focus .ms-view-tools {
    position: fixed;
    right: 12px;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    z-index: 80;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px 6px;
    border-radius: 999px;
    background: var(--jj-surface);
    box-shadow:
      0 0 0 1px var(--jj-border),
      0 10px 28px -8px rgb(16 24 40 / 35%);
  }
  body.board-focus .ms-view-tools button {
    min-width: 40px;
    min-height: 40px;
  }
  body.board-focus #main {
    padding-top: 6px;
  }
}
/* 하루 보기 요일 줄: 요일 위, 날짜 아래로 가지런히. */
@media (max-width: 700px) {
  body .ms-day-view .ms-days {
    position: sticky;
    left: 0;
    width: min(100%, 100vw - 32px);
  }
  body .ms-day-view .ms-days button {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    min-height: 52px;
    padding: 6px 0 7px;
  }
  body .ms-day-view .ms-days .day-name {
    font-size: 15px;
    font-weight: 800;
    line-height: 1.1;
  }
  body .ms-day-view .ms-days .day-date {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--jj-text-tertiary, var(--jj-gray-500));
    font-variant-numeric: tabular-nums;
  }
  body .ms-day-view .ms-days .active {
    box-shadow: inset 0 -3px var(--jj-primary);
  }
  body .ms-day-view .ms-days .active .day-date {
    color: var(--jj-primary);
  }
  body .ms-day-view .ms-days .holiday-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 7px;
    height: 7px;
    padding: 0;
    border-radius: 50%;
    background: var(--jj-danger, #e5484d);
    font-size: 0;
  }
  /* 선생님 칩: 누를 수 있는 버튼 */
  body .ms-teacher-picks .schedule-teacher-place {
    border: 0;
    font: inherit;
    cursor: pointer;
  }
  body .ms-teacher-picks .schedule-teacher-place[aria-pressed="true"] {
    background: var(--jj-primary-50);
    box-shadow: inset 0 0 0 1.5px var(--teacher);
  }
}
@media (max-width: 700px) {
  body .ms-day-view .ms-teacher-picks {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 8px 12px 10px;
  }
  body .ms-day-view .ms-teacher-picks .schedule-teacher-caption {
    flex-basis: 100%;
    font-size: 11.5px;
  }
  body .ms-day-view .ms-teacher-picks .schedule-teacher-place {
    min-height: 32px;
    margin: 0;
    padding: 4px 11px;
    font-size: 13px;
  }
}
