/* Shared customer forms, detail tables and dialogs. Timetables keep their own layout. */
.modal--teacherSearch .teacherSearch__count {
  flex-shrink: 0;
  white-space: nowrap;
}

/* Search result timetables keep readable columns on desktop and mobile pages. */
.modal--teacherSearch .table[data-id^="schedule-"] {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
}

.modal--teacherSearch .table[data-id^="schedule-"] table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

.modal--teacherSearch .table[data-id^="schedule-"] :is(th, td) {
  min-width: 100px;
  white-space: nowrap;
}

.modal-multi .lesson-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  margin: 10px auto;
  padding: 12px 16px;
  border-radius: var(--radius-control);
}

.modal-multi .lesson-summary__teacher {
  flex: 1 1 160px;
  min-width: 0;
  font-size: 16px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.modal-multi .lesson-summary__time {
  flex: 0 0 auto;
  font-size: 14px;
  line-height: 1.4;
  white-space: nowrap;
}

.teacher__application .payment-options {
  flex-wrap: wrap;
  gap: 12px 64px;
}

.teacher__application .payment-options > .radio:first-child {
  margin-left: 60px;
}

.teacher__application .payment-options > .checkbox {
  margin-inline-start: auto;
}

@media not all and (min-width: 1280px) {
  :is(.teacher__reservation-check, .teacher__application),
  :is(.teacher__reservation-check, .teacher__application) .table,
  .table.responsive-details {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  :is(.teacher__reservation-check, .teacher__application) .table > table,
  .table.responsive-details > table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
  }

  :is(.teacher__reservation-check, .teacher__application) .table,
  .table.responsive-details {
    display: block;
  }
}

@media not all and (min-width: 768px) {
  :is(.teacher__reservation-check, .teacher__application) .mark__title {
    flex-wrap: wrap;
    gap: 10px;
  }

  :is(.teacher__reservation-check, .teacher__application) .mark__title p {
    font-size: 20px;
  }

  :is(.teacher__reservation-check, .teacher__application) .mark__title > span {
    height: 30px;
    padding-inline: 12px;
    font-size: 14px;
  }

  :is(.teacher__reservation-check, .teacher__application) .table > table:not(:where(#tbSchedule)),
  :is(.teacher__reservation-check, .teacher__application) .table > table:not(:where(#tbSchedule)) tbody,
  .table.responsive-details > table,
  .table.responsive-details > table > tbody {
    display: block;
    width: 100%;
  }

  :is(.teacher__reservation-check, .teacher__application) .table colgroup,
  .table.responsive-details colgroup {
    display: none;
  }

  :is(.teacher__reservation-check, .teacher__application) .table > table:not(:where(#tbSchedule)) tr,
  .table.responsive-details > table tr {
    display: grid;
    grid-template-columns: minmax(80px, 28%) minmax(0, 1fr);
  }

  .teacher__application .table > table:not(:where(#tbSchedule)) tr {
    grid-template-columns: minmax(0, 1fr);
  }

  .check__table-wrap .table--teacher > table tr {
    grid-template-columns: minmax(80px, 28%) minmax(0, 1fr);
  }

  :is(.teacher__reservation-check, .teacher__application) .table > table:not(:where(#tbSchedule)) :is(th, td),
  .table.responsive-details > table :is(th, td) {
    display: block;
    box-sizing: border-box;
    min-width: 0;
    max-width: none;
    height: auto;
    min-height: 44px;
    padding: 12px;
    font-size: 15px;
    line-height: 1.5;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .teacher__application .input-box {
    flex-wrap: wrap;
    gap: 12px 20px;
  }

  .teacher__application .input-box > :is(.radio, .checkbox) {
    margin: 0;
    max-width: 100%;
  }

  .teacher__application .payment-options > .radio:first-child {
    margin-left: 0;
  }

  .teacher__application .payment-options > .checkbox {
    flex-basis: 100%;
    margin-inline-start: 0;
  }

  .teacher__application .input-box label p {
    font-size: 15px;
    white-space: normal;
  }

  .teacher__application .input-box label input + span {
    flex-shrink: 0;
  }

  :is(.teacher__reservation-check, .teacher__application) .button-wrap > a,
  #step3Div #purchase .apply-btn {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    margin-inline: 0;
  }

  /* Transpose the selected bookings to weekday / time / duration columns. */
  .teacher__reservation-check #tbSchedule {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .teacher__reservation-check #tbSchedule > thead,
  .teacher__reservation-check #tbSchedule > tbody > tr {
    display: flex;
    flex-direction: column;
    min-width: 0;
    border-top: 0;
  }

  .teacher__reservation-check #tbSchedule > tbody,
  .teacher__reservation-check #tbSchedule > thead > tr {
    display: contents;
  }

  #step3Div #tbSchedule :is(th, td) {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    height: 44px;
    min-height: 44px;
    padding: 8px;
    font-size: 14px;
    line-height: 1.4;
  }

  #step3Div #tbSchedule #trSecond td {
    border-bottom: 1px solid var(--color-border, #cdd0d2);
  }

  #step3Div #tbSchedule :is(thead, #trFirst, #trSecond) > :last-child {
    border-bottom: 0;
  }
}

/* Dialog roles are shared by desktop and mobile pages, including wrapper siblings. */
:is(.modal--alert, .modal--form, .modal--content-panel, .modal-idpw) {
  --dialog-width: 420px;
  box-sizing: border-box;
  padding: 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal--form { --dialog-width: 640px; }
.modal--content-panel { --dialog-width: 760px; }
.modal-multi, .modal-checklecture { --dialog-width: 420px; }

:is(.modal--alert, .modal--form, .modal--content-panel, .modal-idpw)[style*="display: block"] {
  display: flex !important; /* jQuery fadeIn leaves an inline display value. */
  align-items: center;
  justify-content: center;
}

:is(.modal--alert, .modal--form, .modal--content-panel, .modal-idpw) .modal__content-wrap {
  position: relative;
  top: auto;
  left: auto;
  transform: none;
  box-sizing: border-box;
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
  max-width: min(var(--dialog-width), calc(100vw - 40px));
  height: auto;
  margin: auto;
  transition: none;
}

:is(.modal--alert, .modal--form, .modal--content-panel, .modal-idpw) .modal__content {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  padding: 24px 20px 20px;
  border-radius: var(--radius-panel);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

:is(.modal--alert, .modal--form, .modal--content-panel, .modal-idpw) .modal__head {
  flex: 0 0 auto;
  min-height: 28px;
  padding-right: 36px;
}

:is(.modal--alert, .modal--form, .modal--content-panel, .modal-idpw) .modal__head h3 {
  font-size: 20px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

:is(.modal--alert, .modal--form, .modal--content-panel, .modal-idpw) .modal__body {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

:is(.modal--alert, .modal--form, .modal--content-panel, .modal-idpw) :is(.modal__close, .modal__close_solo) {
  position: absolute;
  z-index: 2;
  top: 24px;
  right: 20px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .24);
}

:is(.modal--alert, .modal--form, .modal--content-panel, .modal-idpw) :is(.modal__close, .modal__close_solo)::before,
:is(.modal--alert, .modal--form, .modal--content-panel, .modal-idpw) :is(.modal__close, .modal__close_solo)::after {
  width: 18px;
  height: 2px;
  background: #fff;
}

:is(.modal--alert, .modal--form, .modal--content-panel, .modal-idpw) .modal__body :is(div, span, img, input, select, textarea) {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
}

:is(.modal--alert, .modal--form, .modal--content-panel, .modal-idpw) .match__bottom {
  flex: 0 0 auto;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

:is(.modal--alert, .modal--form, .modal--content-panel, .modal-idpw) .match__bottom > .left {
  width: 100%;
}

:is(.modal--alert, .modal--form, .modal--content-panel, .modal-idpw) .match__bottom .button-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
  gap: 8px;
  width: 100%;
  min-width: 0;
}

:is(.modal--alert, .modal--form, .modal--content-panel, .modal-idpw) .button.border-style.popup {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 45px;
  height: auto;
  padding: 10px 12px;
  border-radius: var(--radius-control);
  font-size: 14px;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
}

.modal--form .accounts__form {
  width: 100%;
  max-width: none;
}

.modal--form .accounts__form .input-box .button {
  flex: 0 0 72px;
  width: 72px;
  height: 45px;
  margin-left: 8px;
}

.modal--form .modal__body input:is([type="text"], [type="password"], [type="number"]) {
  box-sizing: border-box;
  width: 100%;
  height: 45px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: #fff;
  font-size: 14px;
  color: var(--color-text);
}

.modal--form .modal__body input:is([type="text"], [type="password"], [type="number"]):focus {
  border-color: var(--color-text-strong);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
  outline: 0;
}

.modal-idpw col.idpw-fields { width: 80%; }
.modal-idpw col.idpw-action { width: 20%; }

.modal--content-panel .level_summary .table {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.modal--content-panel .level_summary .table > table {
  width: 100%;
  table-layout: fixed;
}

@media not all and (min-width: 1280px) {
  .mypage--cbd .table.table--gray.responsive-records {
    display: block;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
  }

  .responsive-records > table {
    min-width: 1100px;
  }
}

@media not all and (min-width: 768px) {
  .table.responsive-details :is(.input-box, .input, .select, .col) {
    min-width: 0;
    max-width: 100%;
  }

  .responsive-details .input-box {
    flex-wrap: wrap;
    gap: 8px;
  }

  .table.responsive-details .select,
  .table.responsive-details .select select {
    width: 100%;
  }

  .mypage--cbd .table.table--gray.responsive-records {
    border: 0;
    background: transparent;
    overflow: visible;
  }

  .mypage--cbd .table.table--gray.responsive-records :is(table, tbody) {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .responsive-records :is(colgroup, thead) {
    display: none;
  }

  .mypage--cbd .table.table--gray.responsive-records tbody tr {
    display: block;
    margin-bottom: 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    background: #fff;
  }

  .mypage--cbd .table.table--gray.responsive-records tbody td {
    display: grid;
    grid-template-columns: minmax(90px, 32%) minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    box-sizing: border-box;
    min-width: 0;
    height: auto;
    min-height: 44px;
    padding: 12px;
    border: 0;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    font-size: 14px;
    line-height: 1.5;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .mypage--cbd .table.table--gray.responsive-records tbody td:last-child {
    border-bottom: 0;
  }

  .mypage--cbd .table.table--gray.responsive-records tbody td.text-left {
    text-align: left;
  }

  .responsive-records td::before {
    content: attr(data-label);
    color: var(--color-text-secondary);
    font-weight: 600;
  }

  .modal--form .accounts__form .row {
    flex-direction: column;
    align-items: stretch;
  }

  .modal--form .accounts__form .form-title {
    width: auto;
    margin-bottom: 8px;
    font-size: 14px;
  }

  .modal--form .accounts__form .input-box {
    width: 100%;
    min-width: 0;
    gap: 8px;
  }

  .modal-chkcoupon #pCouponTitle {
    flex: 1 1 0;
    width: auto;
    overflow-wrap: anywhere;
  }

  .modal--form .coupon-modal__table,
  .modal--form .coupon-modal__table tbody {
    display: block;
    width: 100%;
  }

  .modal--form .coupon-modal__table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 72px;
    gap: 8px;
    margin-bottom: 12px;
  }

  .modal--form .coupon-modal__table th {
    grid-column: 1 / -1;
    width: auto;
    padding: 0;
  }

  .modal--form .coupon-modal__table td,
  .modal--form .coupon-modal__table tr > td:last-child:not([colspan]) {
    width: auto;
    min-width: 0;
    padding: 0;
  }

  .modal--form .coupon-modal__table tr:has(th) td[colspan] {
    grid-column: 1 / -1;
  }

  .modal-idpw col.idpw-fields { width: 72%; }
  .modal-idpw col.idpw-action { width: 28%; }

  /* Evaluation reports use the same stacked label/value pattern. */
  .modal--content-panel .level_summary .table,
  .modal--content-panel .level_summary .table :is(table, tbody) {
    display: block;
    width: 100%;
    min-width: 0;
    table-layout: fixed;
  }

  .modal--content-panel .level_summary colgroup {
    display: none;
  }

  .modal--content-panel .level_summary .table tr {
    display: flex;
    flex-wrap: wrap;
  }

  .modal--content-panel .level_summary .table :is(th, td) {
    display: block;
    box-sizing: border-box;
    flex: 1 1 100%;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
  }
}
