/* 좁은 화면의 업무 양식과 팝업에서 입력·탐색·저장 영역을 확보한다. */
:where(form, fieldset, .panel-body) {
    min-inline-size: 0;
}

:where(input, select, textarea, button, iframe) {
    max-inline-size: 100%;
    box-sizing: border-box;
}

form :is(input[type=text], input[type=search], input[type=password], input[type=email], input[type=tel],
         input[type=number], input[type=date], select, textarea):not([size]),
form .form-control:not([size]) {
    font-size: 16px;
}

form :where(input:not([type=hidden], [type=radio], [type=checkbox], [type=image]), select:not([multiple], [size]), button),
main a.btn {
    min-height: 44px;
}

.office-fields, .office-fields > tbody, .office-fields > tbody > tr,
.inquiry-form > .table-scroll > table, .inquiry-form > table {
    width: 100%;
}

.office-fields > tbody > tr,
.inquiry-form tr:has(> td + td) {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    height: auto;
}

.office-fields > tbody > tr > :is(th, td),
.inquiry-form tr > td {
    display: block;
    width: auto;
    height: auto;
    white-space: normal;
}

.inquiry-form textarea {
    max-height: 45dvh;
}

#smartPop {
    max-width: calc(100% - 8px);
    max-height: calc(100dvh - 8px);
}

#smartPop_container {
    max-height: calc(100dvh - 12px);
}

#smartPop_close {
    flex-basis: 44px;
    min-height: 44px;
}

#smartPop_frame {
    flex: 1 1 auto;
    min-height: 0;
}

/* 명단의 선택·원생명·수정 버튼을 한 줄에 두고 세부 값은 다음 줄부터 표시한다. */
.student-table-wrap .student-table,
.student-table :is(thead, tbody) {
    display: block;
    min-width: 0;
    width: 100%;
}

.student-table thead tr { display: block; }

.student-table thead th:not(.student-col-check) {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
}

.student-table thead .student-col-check {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 8px;
    padding: 0 12px;
}

.student-table .student-select-label {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin: 0;
    white-space: normal;
}

.student-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 6px 12px;
    padding: 8px 12px 14px;
    border-top: 1px solid var(--erp-line);
}

.student-table tbody tr > td,
.student-table tbody tr > :is(td[data-label], td.student-name) {
    min-width: 0;
    width: auto;
    padding: 0;
    border: 0;
    text-align: start;
    white-space: normal;
    overflow-wrap: anywhere;
}

.student-table tbody .student-name,
.student-table tbody .student-col-check,
.student-table tbody .student-col-actions {
    grid-row: 1;
    align-self: center;
}

.student-table tbody .student-name {
    grid-column: 1 / -1;
    margin-inline: 32px 46px;
}

.student-table tbody .student-col-check {
    grid-column: 1;
    justify-self: start;
    position: relative;
}

.student-table tbody .student-col-actions {
    grid-column: 2;
    width: 44px;
    justify-self: end;
}

.student-table .student-icon-btn {
    width: 44px;
    height: 44px;
}

.student-table .student-col-check input {
    width: 22px;
    height: 22px;
}

.student-table .student-address:has(.student-address-text),
.student-table .student-empty-row {
    grid-column: 1 / -1;
}

.student-table .student-address-text {
    max-width: none;
    white-space: normal;
}

:is(.student-table, .roster-card table, .mobile-records) [data-label]::before {
    content: attr(data-label);
    content: attr(data-label) / "";
    display: block;
    color: var(--erp-muted);
    font-size: 12px;
    font-weight: normal;
}

/* 명단의 열 제목을 값 위에 표시하고 원래의 링크와 입력 요소를 그대로 사용한다. */
:is(.content, .content2, .mobile-record-list) table.mobile-records,
.mobile-records > :is(thead, tbody) {
    display: block;
    width: 100%;
    min-width: 0;
}

.mobile-records > thead > tr { display: block; }
.mobile-records > thead th:not(:has(input)) {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
}

.mobile-records > thead th:has(input) {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 8px;
    padding: 0 12px;
}
.mobile-records .student-select-label { display: inline-flex; align-items: center; min-height: 44px; margin: 0; }
.mobile-records input[type=checkbox] { width: 22px; height: 22px; }

.mobile-records > tbody > tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 12px;
    padding: 12px;
    height: auto;
    border-top: 1px solid var(--erp-line);
}

.mobile-records > tbody > tr:has(> [colspan]:only-child:empty) { display: none; }

:is(.student-table, .mobile-records) > tbody > tr:is(:hover, :focus-within) {
    background-color: var(--erp-surface-soft);
}
:is(.student-table, .mobile-records) > tbody > tr:has(input[type=checkbox]:checked) {
    background-color: var(--erp-accent-soft);
}

:is(.content, .content2, .mobile-record-list) .mobile-records > tbody > tr > :is(th, td) {
    display: block;
    position: static;
    width: auto;
    min-width: 0;
    height: auto;
    max-width: none;
    padding: 0;
    border: 0;
    text-align: start;
    white-space: normal;
    overflow-wrap: anywhere;
}

.mobile-records > tbody > tr > :is([colspan], [class$="-col-actions"], .smslog-content, :has(.attendance-choices)) {
    grid-column: 1 / -1;
}
.mobile-records .attendance-choices span { min-height: 44px; align-content: center; }
.mobile-records :is(.btn, .adminlist-icon-btn) { min-height: 44px; min-width: 44px; align-content: center; }
