/* 업무 화면(상벌점 주기·기록·학생 현황·학생 상세·기준 도달·출력·조회) 전용 모양. 값은 tokens.css 변수만 쓴다. */

/* ───── 알림에 단추 여러 개(되돌리기·문자 등) ───── */
.toast-many { flex-wrap: wrap; }
.toast-many .toast-text { flex: 1 1 0; }
.toast-many .toast-close { order: 2; }
.toast-acts { order: 3; flex: 1 0 100%; display: flex; flex-wrap: wrap; gap: var(--sp-2); padding-left: calc(18px + var(--sp-3)); }
a.toast-act { display: inline-flex; align-items: center; text-decoration: none; }
@media (pointer: coarse) { .toast-act { min-height: var(--h-touch); } }

/* ───── 학부모 문자 ───── */
.sms-btns { display: inline-flex; gap: var(--sp-1); flex-wrap: nowrap; }
.sms-btn { gap: var(--sp-1); }
.sms-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.sms-row { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; padding: var(--sp-2) var(--sp-3); border: 1px solid var(--c-line); border-radius: var(--radius); }
.sms-who { flex: 1 1 140px; min-width: 0; display: flex; flex-direction: column; }
.sms-note { display: inline-flex; align-items: center; gap: var(--sp-1); }

/* ───── 상벌점 주기 ───── */
.give-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-5); align-items: start; }
@media (min-width: 960px) { .give-layout { grid-template-columns: minmax(0, 1fr) var(--w-panel); } }
.give-main { min-width: 0; }
.give-pick { display: flex; flex-direction: column; gap: var(--sp-3); }
.give-tools { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }
.give-search { flex: 1 1 200px; max-width: 280px; }
.give-refresh { margin-left: auto; }
.give-tools .check { min-height: var(--h-control); padding: 0; align-items: center; }
.stu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: var(--sp-2); }
@media (max-width: 639px) { .stu-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.stu-card {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0;
  height: 84px; padding: var(--sp-2) var(--sp-3); background: var(--c-surface); color: var(--c-text);
  border: 1px solid var(--c-line-strong); border-radius: var(--radius); text-align: left; overflow: hidden;
}
.stu-card:hover { background: var(--c-bg); }
.stu-card.is-on { border-color: var(--c-primary); background: var(--c-primary-soft); box-shadow: inset 0 0 0 1px var(--c-primary); }
.stu-top { display: flex; align-items: baseline; gap: var(--sp-1); width: 100%; }
.stu-num { font-size: var(--fs-md); font-weight: var(--fw-bold); line-height: 1.3; }
.stu-cls { font-size: var(--fs-xs); color: var(--c-text-sub); }
.stu-check { margin-left: auto; align-self: center; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 10px; background: var(--c-primary); color: var(--c-on-primary); }
.stu-name { width: 100%; font-size: var(--fs-md); line-height: 1.3; }
.stu-score { font-size: var(--fs-md); font-weight: var(--fw-bold); line-height: 1.3; white-space: nowrap; }
.score-split { white-space: nowrap; }

/* PC 오른쪽 판: 화면 높이 안에 전체가 들어오고(선택한 학생·구분이 위에 늘 보임), 저장 단추는 아래에 붙어 있으며, 줄어드는 것은 항목 목록뿐이다 */
.give-panel { position: sticky; top: calc(56px + var(--sp-4)); display: flex; flex-direction: column; gap: var(--sp-3); height: calc(100vh - 56px - var(--sp-4) * 2); overflow-y: auto; }
.give-panel > * { flex: none; }
.give-panel > .give-form { flex: 1 1 auto; min-height: 0; }
.give-panel .give-form { gap: var(--sp-2); }
.give-panel .give-form .check { min-height: var(--h-control-sm); padding: 0; align-items: center; }
.give-panel .give-form .check input { margin: 0; }
.give-panel .give-form > * { flex: none; }
.give-panel .give-form > .give-items { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.give-panel .give-items .item-picker { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.give-panel .item-list, .give-panel .item-list.is-many { flex: 1 1 auto; min-height: 96px; max-height: none; overflow-y: auto; }
.give-panel .sel-chips { max-height: 64px; }
.give-panel .give-save { position: static; margin-top: 0; }
.give-panel-head { display: flex; align-items: center; gap: var(--sp-2); }
.give-panel-head h2 { flex: 1 1 auto; font-size: var(--fs-md); }
.give-form { gap: var(--sp-4); }
.give-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--sp-4); align-items: start; }
.pts-fixed { display: inline-flex; align-items: center; gap: var(--sp-2); height: var(--h-control); }
.give-save { position: sticky; bottom: calc(var(--sp-4) * -1); display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-3) 0 0; margin-top: auto; background: var(--c-surface); border-top: 1px solid var(--c-line); }
.give-why { text-align: center; min-height: 20px; }
.sel-chips { display: flex; flex-wrap: wrap; gap: var(--sp-1); max-height: 96px; overflow-y: auto; }
.sel-chip { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; height: var(--h-control-sm); padding: 0 var(--sp-1) 0 var(--sp-2); background: var(--c-primary-soft); color: var(--c-primary); border-radius: var(--radius-lg); font-size: var(--fs-xs); font-weight: var(--fw-bold); }
.sel-chip button { position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none; width: 24px; height: 24px; padding: 0; border: 0; border-radius: var(--radius-lg); background: none; color: inherit; }
.sel-chip button::after { content: ""; position: absolute; inset: -10px; }
.sel-chip button:hover { background: var(--c-surface); }

.item-picker { display: flex; flex-direction: column; gap: var(--sp-2); }
.item-list { display: flex; flex-direction: column; border: 1px solid var(--c-line-strong); border-radius: var(--radius); background: var(--c-surface); }
.item-list.is-many { max-height: 264px; overflow-y: auto; }
.item-group { position: sticky; top: 0; z-index: 1; padding: var(--sp-1) var(--sp-3); background: var(--c-bg); border-bottom: 1px solid var(--c-line); font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--c-text-sub); }
.item-row { display: flex; align-items: center; gap: var(--sp-3); min-height: var(--h-control); padding: var(--sp-1) var(--sp-3); border-bottom: 1px solid var(--c-line); cursor: pointer; }
.item-row:last-child { border-bottom: 0; }
.item-row:hover { background: var(--c-bg); }
.item-row input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--c-primary); }
.item-row.is-on { background: var(--c-primary-soft); font-weight: var(--fw-bold); }
.item-row:has(input:focus-visible) { outline: 2px solid var(--c-focus); outline-offset: -2px; }
.item-name { flex: 1 1 auto; min-width: 0; }
.item-range { flex: none; font-size: var(--fs-sm); color: var(--c-text-sub); font-weight: var(--fw-normal); }
.item-none { padding: var(--sp-3); }
@media (pointer: coarse) { .item-row { min-height: var(--h-touch); } }

/* 휴대폰: 아래 막대(탭 막대 바로 위) + 올라오는 판 */
.give-page.has-bar { padding-bottom: calc(var(--sp-4) + 64px); }
.give-bar {
  position: fixed; left: 0; right: 0; bottom: calc(56px + env(safe-area-inset-bottom)); z-index: 29;
  display: flex; align-items: center; gap: var(--sp-2); height: 56px; padding: 0 var(--sp-4);
  background: var(--c-surface); border-top: 1px solid var(--c-line); box-shadow: var(--shadow-2);
}
.give-bar-text { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer .give-save { position: static; border-top: 0; padding-top: 0; width: 100%; }
.drawer .modal-foot { display: block; }

/* ───── 기록·학생 현황·학생 상세·기준 도달 공용 ───── */
.plain-link { color: inherit; text-decoration: none; }
.plain-link:hover { color: var(--c-primary); text-decoration: underline; }
.cell-clip { display: block; max-width: 220px; }
/* 기록 표: 사유 칸이 남는 폭을 쓰고(길면 말줄임), 나머지 칸은 내용 폭 — 1280px 에서 동작 칸까지 모두 보인다 */
.table td.col-reason { width: 100%; max-width: 0; min-width: 120px; }
.table td.col-reason .cell-clip { max-width: none; }
.table td.col-item { min-width: 96px; max-width: 240px; line-height: 1.35; }
.rec-acts { flex-wrap: nowrap; }
.rec-reason { color: var(--c-text-sub); overflow-wrap: anywhere; }
.rec-toolbar { align-items: flex-end; }
.rec-toolbar .field { min-width: 120px; }
.rec-toolbar .check { padding-bottom: 0; }
.is-loading { opacity: 0.6; transition: opacity var(--dur); }
.table tr.is-void td { color: var(--c-text-off); text-decoration: line-through; }
.table tr.is-void td .btn, .table tr.is-void td .chip, .table tr.is-void td a { text-decoration: none; }
.row-card.is-void .row-card-title, .row-card.is-void .rec-reason { text-decoration: line-through; color: var(--c-text-off); }
.year-select { width: 140px; flex: none; }
.toolbar > .check { min-height: var(--h-control); padding: 0; align-items: center; }
.stu-reach { justify-content: flex-start; }
.back-link { align-self: flex-start; display: inline-flex; align-items: center; gap: var(--sp-1); min-height: var(--h-control); color: var(--c-text-sub); text-decoration: none; font-size: var(--fs-sm); }
.back-link:hover { color: var(--c-primary); }
.qr-center { display: flex; justify-content: center; }
.ms-step { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ms-step-text { color: var(--c-text); }
.table .ms-step { white-space: normal; }

/* ───── 학생·학부모 조회(로그인 없음) ───── */
.view-page { max-width: 560px; margin: 0 auto; padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-4); min-height: 100vh; }
.view-head { display: flex; align-items: center; gap: var(--sp-2); color: var(--c-primary); font-weight: var(--fw-bold); font-size: var(--fs-lg); min-width: 0; }
.view-school { min-width: 0; }
.view-who { display: flex; flex-direction: column; gap: var(--sp-2); align-items: flex-start; }
.view-who h1 { font-size: var(--fs-xl); overflow-wrap: anywhere; }
.view-stats { grid-template-columns: repeat(2, 1fr); }
.view-foot { margin-top: auto; padding-top: var(--sp-4); color: var(--c-text-sub); font-size: var(--fs-sm); text-align: center; }

/* ───── 출력 ───── */
.print-form { display: flex; flex-direction: column; gap: var(--sp-4); }
.print-target { align-items: end; }
@media (min-width: 640px) { .form-grid.cols-2.print-target { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); } }
.print-form .seg { align-self: flex-start; }
.print-form .seg-btn { min-width: 110px; }
.print-preview { display: flex; flex-direction: column; gap: var(--sp-4); align-items: center; overflow-x: auto; padding-bottom: var(--sp-2); }
.sheet { width: 180mm; flex: none; box-sizing: border-box; background: #fff; color: #000; border: 1px solid var(--c-line-strong); box-shadow: var(--shadow-1); padding: 8mm; font-size: 10.5pt; display: flex; flex-direction: column; gap: 4mm; }
.sheet-head { display: flex; flex-direction: column; gap: 1mm; text-align: center; border-bottom: 0.4mm solid #000; padding-bottom: 3mm; }
.sheet-school { font-size: 10pt; }
.sheet-title { font-size: 16pt; }
.sheet-meta { display: flex; flex-direction: column; gap: 1mm; }
.sheet-meta > div { display: flex; gap: 3mm; }
.sheet-meta dt { flex: none; width: 14mm; color: #333; }
.sheet-meta dd { min-width: 0; }
.sheet-table { width: 100%; }
.sheet .table th, .sheet .table td { color: #000; background: #fff; border-bottom: 0.2mm solid #000; padding: 1.2mm 2mm; height: auto; font-size: 9.5pt; text-align: left; vertical-align: top; }
.sheet .table th { background: #eee; border-top: 0.2mm solid #000; }
.sheet .table .col-num { text-align: right; }
.sheet-none { padding: 6mm 0; text-align: center; color: #333; }
.sheet-foot { margin-top: auto; padding-top: 3mm; text-align: right; font-size: 9pt; color: #333; }
.notice-sheet { padding: 0; border: 0; box-shadow: none; background: transparent; }
.notice-grid { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(4, 62mm); gap: 4mm; }
.notice-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.5mm; padding: 3mm; border: 0.3mm dashed #000; background: #fff; text-align: center; overflow: hidden; }
.notice-school { font-size: 9pt; color: #333; }
.notice-who { font-size: 11pt; }
.notice-qr svg { display: block; }
.notice-qr .qr-box { padding: 0; border: 0; border-radius: 0; background: #fff; }
.notice-url { font-size: 6.5pt; line-height: 1.2; word-break: break-all; max-width: 100%; color: #000; }
.notice-desc { font-size: 8pt; color: #333; line-height: 1.3; }
@media (max-width: 959px) { .print-preview { align-items: flex-start; } }

/* 처벌 기간 중 동일 위반(벌점 2배) 표시 */
.x2-mark { display: inline-block; padding: 0 var(--sp-2); border-radius: var(--radius); background: var(--c-warn-soft); color: var(--c-warn); font-size: var(--fs-xs); font-weight: var(--fw-bold); white-space: nowrap; vertical-align: middle; }

/* 쓰는 상쇄점 항목이 없을 때 합계 카드 수가 줄어도 칸 폭이 어색하지 않게 */
@media (min-width: 640px) { .stats.stats-3 { grid-template-columns: repeat(3, 1fr); } .stats.stats-2 { grid-template-columns: repeat(2, 1fr); } }
.sms-body { flex: 1 0 100%; padding: var(--sp-2) var(--sp-3); background: var(--c-bg); border-radius: var(--radius); color: var(--c-text); overflow-wrap: anywhere; }

/* ───── 학생 관리 휴대폰 카드: 한 줄에 「번호 이름」, 동작은 낮은 한 줄 ───── */
.row-card:has(.stu-line) { padding: var(--sp-2) var(--sp-3); gap: var(--sp-1); }
.stu-line { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; min-height: 28px; }
.stu-line-no { flex: none; min-width: 2.4em; font-weight: var(--fw-bold); color: var(--c-primary); }
.stu-line-name { flex: 1 1 auto; min-width: 0; }
.stu-line-phone { flex: none; }
.stu-acts .row { width: 100%; flex-wrap: nowrap; gap: var(--sp-1); }
.stu-acts .btn { flex: 1 1 0; min-width: 0; padding: 0 var(--sp-1); }
.stu-edit { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-2) 0; }
.stu-edit .input { height: var(--h-control); font-size: var(--fs-md); }
.stu-edit .row-card-actions .row { width: 100%; justify-content: flex-end; }

/* 설정: 단계 이름 줄·문자 미리 보기 */
.step-no { flex: none; min-width: 3.5em; }
.sms-sample { margin: 0; padding: var(--sp-3); background: var(--c-bg); border-radius: var(--r-md, 8px); font-size: var(--fs-sm); overflow-wrap: anywhere; }

/* 2단계 인증 */
.otp-qr { display: flex; justify-content: center; }
.otp-row { align-items: center; padding: var(--sp-2) 0; border-bottom: 1px solid var(--c-line); }
.otp-row .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.list-plain { list-style: none; margin: 0; padding: 0; }
