/* 자리 바꾸기 · 좌석 배치표 */
.sa-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.sa-main { display: grid; gap: 14px; min-width: 0; padding: clamp(16px, 2.6vw, 26px); }
.sa-side { display: grid; gap: 12px; position: sticky; top: 86px; }
.sa-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.sa-modes { display: flex; flex-wrap: wrap; gap: 6px; }
.sa-mode { min-height: 38px; padding: 0 12px; border: 1.5px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--text); font-size: 14px; font-weight: 700; cursor: pointer; touch-action: manipulation; }
.sa-mode[aria-pressed="true"] { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface)); color: var(--link); }

/* 교실 */
.sa-room { display: flex; flex-direction: column; gap: 18px; padding: clamp(14px, 3vw, 26px); border-radius: var(--r-lg); background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 5%, var(--surface)), var(--surface)); border: 1px solid var(--line); overflow-x: auto; }
.sa-room.teacher { flex-direction: column-reverse; background: linear-gradient(0deg, color-mix(in srgb, var(--primary) 5%, var(--surface)), var(--surface)); }
.sa-board { align-self: center; width: min(420px, 70%); padding: 10px; border-radius: 12px; background: #2f5f57; color: #fff; text-align: center; font-weight: 800; font-size: 15px; letter-spacing: .02em; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .15); }
.sa-grid { display: grid; gap: 10px; min-width: 460px; }
.sa-seat { position: relative; display: grid; place-items: center; min-height: 64px; padding: 16px 4px 8px; border: 1.5px solid color-mix(in srgb, var(--primary) 28%, var(--line)); border-radius: 14px; background: var(--surface); color: var(--text); cursor: pointer; touch-action: manipulation; transition: transform .15s, box-shadow .15s, border-color .15s; }
.sa-seat small { position: absolute; top: 4px; left: 8px; color: var(--subtle); font-size: 10.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sa-seat b { font-size: 15.5px; font-weight: 800; line-height: 1.25; word-break: keep-all; overflow-wrap: anywhere; }
.sa-seat i { position: absolute; top: 3px; right: 6px; font-style: normal; font-size: 12px; }
.sa-seat.on { background: color-mix(in srgb, var(--primary) 9%, var(--surface)); }
.sa-seat.off { border-style: dashed; border-color: var(--line); background: repeating-linear-gradient(45deg, transparent 0 6px, color-mix(in srgb, var(--text) 4%, transparent) 6px 12px); }
.sa-seat.locked { border-color: #e0a100; background: color-mix(in srgb, #ffc94d 20%, var(--surface)); }
.sa-seat.picked { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 22%, transparent); transform: translateY(-2px); }
.sa-seat.warn { border-color: #e5484d; box-shadow: 0 0 0 3px color-mix(in srgb, #e5484d 18%, transparent); }
.sa-seat:hover:not(.off) { border-color: var(--primary); }
.sa-aisle { display: block; }
.sa-grid.spin .sa-seat.on b { opacity: .55; }
@media (prefers-reduced-motion: no-preference) {
  .sa-grid.pop .sa-seat.on { animation: sa-pop .45s var(--ease, ease) both; }
  @keyframes sa-pop { 0% { transform: scale(.92); } 60% { transform: scale(1.04); } 100% { transform: scale(1); } }
}
.sa-status { margin: -2px 0 0; color: var(--muted); font-size: 14px; font-weight: 600; }
.sa-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.sa-go { min-width: 170px; font-size: 16px; }

/* 옆 설정 */
.sa-box { padding: 0; }
.sa-box > summary { padding: 15px 18px; font-weight: 800; font-size: 15px; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.sa-box > summary::-webkit-details-marker { display: none; }
.sa-box > summary::after { content: ''; width: 8px; height: 8px; border-right: 2px solid var(--subtle); border-bottom: 2px solid var(--subtle); transform: rotate(45deg); transition: transform .2s; }
.sa-box[open] > summary::after { transform: rotate(-135deg); }
.sa-box > :not(summary) { margin-left: 18px; margin-right: 18px; }
.sa-box > :last-child { margin-bottom: 18px; }
.sa-box .field { margin-bottom: 12px; }
.sa-box .field-label small { color: var(--subtle); font-weight: 500; }
.sa-box textarea, .sa-box input[type=text] { width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); font-size: 15.5px; line-height: 1.6; resize: vertical; }
.sa-box > textarea { display: block; width: calc(100% - 36px); }
.sa-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.sa-numgen { display: inline-flex; align-items: center; gap: 6px; }
.sa-numgen input { width: 70px; min-height: 36px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); font-size: 15px; }
.sa-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sa-full { display: flex; }
.sa-full label { flex: 1; text-align: center; }
.sa-full span { padding-inline: 6px; }
.sa-check { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; font-size: 14.5px; font-weight: 600; cursor: pointer; }
.sa-check input { width: 18px; height: 18px; accent-color: var(--primary); }

@media (max-width: 1020px) {
  .sa-layout { grid-template-columns: 1fr; }
  .sa-side { position: static; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); align-items: start; }
}
@media (max-width: 560px) {
  .sa-room { padding: 12px 8px; }
  .sa-grid { gap: 4px; min-width: 0; }
  .sa-aisle { min-width: 4px; }
  .sa-seat { min-height: 52px; border-radius: 10px; padding: 13px 1px 5px; }
  .sa-seat small { left: 5px; font-size: 9px; }
  .sa-seat b { font-size: 12.5px; letter-spacing: -.04em; }
  .sa-actions .btn { flex: 1 1 calc(50% - 4px); padding: 0 10px; }
  .sa-go { flex-basis: 100% !important; }
}

/* 인쇄 (A4 가로) */
#lf-print { display: none; }
@page { size: A4 landscape; margin: 10mm; }
@media print {
  body.lf-printing > *:not(#lf-print) { display: none !important; }
  body.lf-printing #lf-print { display: block !important; }
  body.lf-printing { background: #fff !important; }
  #lf-print .sa-paper { -webkit-print-color-adjust: exact; print-color-adjust: exact; color: #1f2a37; }
  #lf-print h2 { margin: 0; text-align: center; font-size: 24pt; }
  #lf-print p { margin: 2mm 0 6mm; text-align: center; color: #64748b; font-size: 11pt; }
  #lf-print .sa-room { border: 0; padding: 0; background: none; overflow: visible; }
  #lf-print .sa-grid { min-width: 0; gap: 3mm; }
  #lf-print .sa-seat { min-height: 17mm; border: 1.5px solid #9fcfc5; background: #fff; box-shadow: none; transform: none; }
  #lf-print .sa-seat.off { border-style: dashed; border-color: #ddd; }
  #lf-print .sa-seat b { font-size: 14pt; }
  #lf-print .sa-seat i { display: none; }
}

/* 숨긴 라디오가 칸 밖으로 늘어나 화면을 넓히지 않도록 */
.sa .segmented input { inset: 0; width: 100%; height: 100%; margin: 0; }
