/* 수업 교체 화면 — 색은 styles.css 의 토큰만 씁니다. 눌러서 쓰는 것(시간표 칸)만 상자로 두고, 결과는 글자와 줄로만 */
.sw-drop { display: grid; justify-items: center; gap: 10px; width: 100%; min-height: clamp(220px, 34vw, 320px); align-content: center; padding: 32px; border: 1.5px dashed var(--line); border-radius: 24px; background: none; color: var(--muted); font: inherit; text-align: center; cursor: pointer; transition: border-color .25s ease, color .25s ease, background .25s ease; }
.sw-drop b { color: var(--text); font-size: clamp(1.15rem, 2.2vw, 1.5rem); font-weight: 400; word-break: keep-all; }
.sw-drop span { word-break: keep-all; } .sw-drop small { font-size: .82rem; }
.sw-drop:hover, .sw-drop:focus-visible { border-color: var(--muted); color: var(--text); }

.sw-top { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px; margin: 0 0 clamp(24px, 3vw, 36px); }
.sw-sel { height: 46px; max-width: 100%; padding: 0 44px 0 22px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%239b9b9b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m1 1.5 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 20px center; color: var(--text); font: inherit; cursor: pointer; -webkit-appearance: none; appearance: none; transition: border-color .25s ease; }
.sw-sel:focus { outline: 0; border-color: var(--muted); }

.sw-grid { width: 100%; max-width: 820px; border-collapse: separate; border-spacing: clamp(4px, 1vw, 8px); table-layout: fixed; }
.sw-grid th { font-size: .82rem; font-weight: 500; color: var(--muted); text-align: center; padding: 2px 0; }
.sw-grid thead th:first-child, .sw-grid tbody th { width: 2.2em; }
.sw-grid td { padding: 0; }
.sw-c, .sw-free, .sw-no { display: grid; place-items: center; align-content: center; gap: 2px; width: 100%; height: clamp(52px, 7vw, 64px); border-radius: 14px; }
.sw-c { padding: 4px 2px; border: 0; background: var(--surface); color: var(--text); font: inherit; line-height: 1.2; cursor: pointer; transition: background .2s ease, color .2s ease; }
.sw-c b { font-size: .92rem; font-weight: 500; } .sw-c small { font-size: .72rem; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sw-c:hover { background: var(--surface2); }
.sw-c.on { background: var(--text); color: var(--bg); } .sw-c.on small { color: inherit; opacity: .75; }
.sw-free { border: 1px dashed var(--line); } .sw-no { opacity: 0; }
.sw-hint { margin: 28px 0 0; color: var(--muted); }

.sw-sel-t { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin: clamp(40px, 6vw, 72px) 0 clamp(20px, 3vw, 32px); font-size: clamp(1.2rem, 2.4vw, 1.6rem); } .sw-sel-t span { color: var(--muted); font-size: 1rem; }
.sw-res { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 44px clamp(32px, 5vw, 72px); }
.sw-h { margin: 0 0 8px; font-size: .86rem; font-weight: 500; color: var(--muted); } .sw-h small { margin-left: 6px; font-weight: 400; }
.sw-list { list-style: none; margin: 0; padding: 0; }
.sw-list li { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.sw-list b { font-weight: 500; } .sw-list span { flex: 1; min-width: 0; color: var(--muted); font-size: .92rem; word-break: keep-all; }
.sw-tag { padding: 2px 10px; border-radius: 999px; background: var(--surface); font-size: .76rem; font-style: normal; color: var(--text); }
.sw-empty { margin: 14px 0 0; color: var(--muted); }
.sw-more { margin-top: 20px; }
.sw-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; margin-top: clamp(56px, 8vw, 96px); font-size: .86rem; } .sw-foot span { color: var(--muted); }

/* 선택한 수업과 맞바꿀 수 있는 빈 시간에 후보를 표시 */
.sw-target { padding: 4px 2px; border: 1px solid var(--muted); background: var(--surface2); }
.sw-target small { font-size: .65rem; }
.sw-target.on { border-color: var(--text); background: var(--text); color: var(--bg); } .sw-target.on small { color: inherit; opacity: .85; }   /* 눌러서 고른 교체 가능 칸: 수업을 고른 칸(.sw-c.on)과 같은 선택 색 */

/* 정사각형 시간표와 후보 명단: 공간이 부족하면 자연스럽게 다음 줄로 */
.sw-layout { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--gap-section); }
.sw-board { flex: 1 1 460px; width: 100%; min-width: 0; }
.sw-detail { flex: 1 1 320px; min-width: 0; }
.sw-board .sw-grid { max-width: none; }
.sw-board .sw-c, .sw-board .sw-free, .sw-board .sw-no { height: auto; aspect-ratio: 1; }
.sw-detail .sw-sel-t { margin: 0 0 var(--gap-head); }
.sw-detail .sw-res { grid-template-columns: minmax(0, 1fr); gap: var(--gap-head); }
.sw-detail .sw-hint { margin: 0; }

/* 후보 선택부터 계획서 내려받기까지 */
/* 후보 선생님은 눌러서 고르는 단추임이 한눈에 보이게: 둥근 상자 + 오른쪽 "선택 ›" */
.sw-list li:has(.sw-choice) { padding: 0; border: 0; margin-bottom: 10px; }
.sw-choice { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 16px; width: 100%; padding: 14px 18px; border: 0; border-radius: 16px; background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: background-color .25s ease; }
.sw-choice:hover, .sw-choice:focus-visible { background: var(--surface2); }
.sw-choice b { grid-column: 1; } .sw-choice span { grid-column: 1; color: var(--muted); font-size: .9rem; }
.sw-go { grid-column: 2; grid-row: 1 / span 2; font-style: normal; font-size: .9rem; color: var(--muted); white-space: nowrap; text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }   /* 눌러서 고르는 곳임을 밑줄로 */
.sw-choice:hover .sw-go, .sw-choice:focus-visible .sw-go { color: var(--text); text-decoration-thickness: 2px; }
/* 같은 선생님 묶음: 이름 한 번 + 아래에 수업 줄들 */
.sw-list li.sw-grp { display: block; background: var(--surface); border-radius: 16px; padding: 14px 8px 8px; }
.sw-gn { display: flex; align-items: baseline; gap: 8px; margin: 0; padding: 0 12px 8px; font-weight: 600; font-size: 1rem; } .sw-gn b { font-weight: 600; } .sw-gn small { color: var(--muted); font-weight: 400; font-size: .84rem; }
.sw-gl { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; } .sw-list .sw-gl li { display: block; margin: 0; padding: 0; border: 0; }
.sw-choice.sw-sub { background: transparent; padding: 11px 12px; border-radius: 12px; } .sw-choice.sw-sub:hover, .sw-choice.sw-sub:focus-visible { background: var(--surface2); }
.sw-list .sw-choice.sw-sub span { flex: none; color: var(--text); font-size: .95rem; } .sw-choice.sw-sub .sw-go { grid-row: 1; }
.sw-plan { margin-top: var(--gap-section); }
.sw-plan h3 { font-weight: 500; }
.sw-plan-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: var(--gap-head); margin-bottom: var(--gap-head); }
.sw-plan-fields label { display: grid; min-width: 0; gap: 8px; }
.sw-plan-fields label > span { font-size: .82rem; color: var(--muted); }
.sw-plan-fields .inp { min-width: 0; max-width: 100%; }
.sw-plan-pending { margin: var(--gap-head) 0; }
.sw-plan-pending p { overflow-wrap: anywhere; }
.sw-plan-rows { padding: 0; margin: var(--gap-head) 0; list-style: none; }
.sw-plan-rows li { display: flex; align-items: center; gap: var(--gap-head); justify-content: space-between; padding: var(--gap-head) 0; border-bottom: 1px solid var(--line); }
.sw-plan-rows small { display: block; margin-top: 8px; color: var(--muted); line-height: 1.6; }

/* 두 단의 높이가 다르면 짧은 쪽은 제자리에 있고 긴 쪽이 먼저 스크롤됨 (메인 대시보드와 같은 방식) */
/* 두 단이 나란히 있는 폭(720px↑)에서는 줄바꿈 없이 항상 나란히 두고 둘 다 고정 */
@media (min-width: 720px) { .sw-layout { flex-wrap: nowrap; } .sw-board { flex: 1 1 340px; } .sw-detail { flex: 1 1 300px; } .sw-layout > * { position: sticky; top: calc(var(--hdr-h, 69px) + 32px); } }

/* 계획서 미리보기: HWPX 양식 모습 그대로 (종이 느낌, 색은 토큰만) */
.sw-paper-wrap { margin-top: var(--gap-section); }
.sw-paper { max-width: 860px; margin: 14px auto 0; padding: clamp(20px, 4vw, 44px); border: 1px solid var(--line); border-radius: 8px; background: var(--surface); position: relative; font-size: .86rem; line-height: 1.6; }
.sw-paper h4 { margin: 0 0 18px; text-align: center; font-size: 1.5rem; font-weight: 500; letter-spacing: .08em; }
.sw-paper p { margin: 2px 0; } .sw-paper .note { margin-top: 8px; font-size: .78rem; color: var(--muted); } .sw-paper .note + .note { margin-top: 0; } .sw-paper .school { margin-top: 28px; text-align: center; font-size: 1rem; }
.sw-paper table { width: 100%; min-width: 640px; margin: 14px 0 6px; border-collapse: collapse; table-layout: fixed; text-align: center; }
.sw-paper th, .sw-paper td { height: 2.1em; padding: 2px 4px; border: 1px solid var(--muted); word-break: keep-all; overflow-wrap: anywhere; }
.sw-paper th { font-weight: 500; background: var(--surface2); font-size: .78rem; }
.sw-paper tr.draft td { opacity: .5; }

/* 결강 시작일·종료일은 항상 한 줄에 나란히, 결강이유는 윗줄 전체 */
.sw-plan .sw-plan-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sw-plan > .sw-plan-fields > label:first-child { grid-column: 1 / -1; }
.sw-plan-fields .inp { width: 100%; }

/* 결강이유 선택 화살표: 오른쪽 끝에 붙지 않게 입력칸의 안쪽 여백(16px)과 같은 간격으로 */
.sw-plan select.inp, .sw-plan .dp-b { -webkit-appearance: none; appearance: none; padding-right: 44px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%239b9b9b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m1 1.5 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 18px center; cursor: pointer; }

/* 다운로드 단추는 양식 안쪽 오른쪽 위 */
.sw-dl { position: absolute; top: clamp(14px, 2.4vw, 24px); right: clamp(14px, 2.4vw, 24px); }
.sw-tbl { overflow-x: auto; }

/* 담은 수업 목록의 구분선은 각 항목의 위쪽에 */
.sw-plan-rows li { border-bottom: 0; border-top: 1px solid var(--line); }

/* 방금 담은 수업은 잠깐 강조해서 무엇이 달라졌는지 바로 보이게 */
.sw-plan-rows li.fresh { animation: swFresh 1.8s ease-out; }
@keyframes swFresh { 0%, 35% { background: var(--surface); } 100% { background: transparent; } }

/* 화면이 넓어 시간표가 커져도 마지막 교시까지 한 화면에 들어오게: 보이는 높이에 맞춰 시간표 폭을 제한 */
.sw-board { max-width: max(340px, calc((100dvh - var(--hdr-h, 69px) - 290px) * 5.6 / (var(--rows, 7) + 0.8))); }
/* 단추로 화면이 움직일 때 상단바에 가리지 않게 */
.sw-list, .sw-plan-pending, .sw-paper { scroll-margin-top: calc(var(--hdr-h, 69px) + 24px); scroll-margin-bottom: 24px; }

/* 보강 선생님을 고르기 전에도 같은 칸을 흐리게 보여 줘서 화면이 나타났다 사라지며 튀지 않게 */
.sw-plan-pending.off { opacity: .45; }
.sw-plan-pending.off p { color: var(--muted); }
.sw-plan-pending .btn:disabled { cursor: default; }

/* 제목과 교사 선택 줄은 아래로 스크롤해도 상단바 아래에 계속 보이게 */
.sw-head .page-h { margin-bottom: 0; }
.sw-head .sw-top { margin-bottom: 0; padding-bottom: 14px; }
@media (min-width: 720px) {
  .sw-head { position: sticky; top: var(--hdr-h, 69px); z-index: 6; background: var(--bg); padding-bottom: 4px; margin-bottom: clamp(16px, 2.4vw, 28px); }
}

/* 위쪽 여백을 고정 줄 안으로 옮겨서, 스크롤을 시작해도 제목이 살짝 올라가지 않고 처음 자리에 그대로 있게 */
.wrap:has(> .sw-head) { padding-top: 0; }
.sw-head { padding-top: var(--gap-head); }

/* 한 단으로 쌓이는 폭(720px 미만)에서는 제목·시간표·후보·계획서를 같은 폭(최대 640px)의 한 줄로 가운데에 모음 */
@media (max-width: 719px) {
  .wrap:has(> .sw-head) > * { max-width: 640px; margin-left: auto; margin-right: auto; }
  .sw-board { max-width: none; }
  .sw-paper-wrap { max-width: 640px; }
}

/* 다운로드: 글자 없는 동그라미 단추 (설명은 눌러 보기 전 툴팁·접근성 이름으로) */
.sw-dl { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: var(--text); color: var(--bg); cursor: pointer; transition: opacity .25s ease; }
.sw-dl:hover, .sw-dl:focus-visible { opacity: .82; }

.sw-plan-fields select.inp { font-variant-numeric: tabular-nums; }   /* 날짜 숫자 폭을 같게 */
/* 날짜 목록: 날짜 칸과 주차 칸을 나눠 줄이 반듯하게 */
.dp { display: grid; gap: 8px; min-width: 0; } .dp-l { font-size: .82rem; color: var(--muted); } .dp-box { position: relative; }
.dp-b { display: grid; grid-template-columns: 3.6em minmax(0, 1fr); align-items: center; gap: 8px; text-align: left; font-variant-numeric: tabular-nums; }
.dp-d { font-variant-numeric: tabular-nums; } .dp-w { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dp-list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none; max-height: min(300px, 55vh); overflow-y: auto; overscroll-behavior: contain; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--float-hi); } .dp-list[hidden] { display: none; }
.dp-list li { margin: 0; padding: 0; border: 0; display: block; }
.dp-o { display: grid; grid-template-columns: 3.6em minmax(0, 1fr); gap: 8px; width: 100%; padding: 10px 14px; border: 0; border-radius: 10px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; font-variant-numeric: tabular-nums; transition: background-color .2s ease; }
.dp-o:hover, .dp-o:focus-visible { background: var(--surface2); } .dp-o .dp-w { color: var(--muted); } .dp-o.on { font-weight: 600; background: var(--surface2); } .dp-o.on .dp-w { color: var(--text); }
.sw-plan .dp-b { padding: 11px 30px 11px 14px; background-position: right 11px center; grid-template-columns: 3.1em minmax(0, 1fr); gap: 6px; font-size: .95rem; }   /* 닫혀 있을 때도 "10/26 다음 주"가 잘리지 않게 */

/* 시간표 엑셀 안내 팝업: 엑셀 모양을 그림으로 */
.sw-guide, .d-guide { display: block; margin: 14px auto 0; font-size: .86rem; }
.ttg-dlg { width: min(640px, 94vw); max-height: 92vh; overflow-y: auto; padding: 26px clamp(18px, 4vw, 30px); border: 0; border-radius: 26px; background: var(--bg); color: var(--text); box-shadow: var(--float-hi); }
.ttg-dlg::backdrop { background: rgba(0, 0, 0, .45); }
.ttg-dlg h3 { margin: 0 0 10px; font-size: 1.25rem; font-weight: 500; } .ttg-lead { margin: 0 0 16px; color: var(--muted); line-height: 1.65; word-break: keep-all; } .ttg-lead b, .ttg-tips b { color: var(--text); font-weight: 600; }
.ttg-sheet { position: relative; margin: 0 0 18px; padding: 14px 12px 46px; border-radius: 16px; background: var(--surface); overflow-x: auto; }
.ttg-title { margin: 0 0 8px; padding: 0 2px; font-weight: 600; font-size: .86rem; }
.ttg-sheet table { border-collapse: collapse; width: 100%; min-width: 520px; font-size: .78rem; background: #fff; color: #333; }
.ttg-sheet td, .ttg-sheet th { border: 1px solid #cfd2d8; padding: 5px 4px; text-align: center; font-weight: 400; white-space: nowrap; }
.ttg-r1 th { background: #fbe9c4; box-shadow: inset 0 -3px 0 #e8a93a; } .ttg-r2 td { background: #dbe8fb; box-shadow: inset 0 -3px 0 #4a86e8; font-weight: 600; }
.ttg-name { font-weight: 600; } .ttg-cls td { background: #e6f4e8; color: #2a6b3c; } .ttg-dim { color: #9aa0aa; }
.ttg-more td { color: #8b9099; background: #f6f7f9; font-size: .74rem; }
.ttg-tag { position: absolute; bottom: 12px; font-size: .78rem; padding: 3px 9px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.ttg-tag.a { left: 12px; background: #fbe9c4; color: #7a5410; } .ttg-tag.b { left: 84px; background: #dbe8fb; color: #1f4e9c; } .ttg-tag.c { left: 186px; background: #e6f4e8; color: #2a6b3c; }
.ttg-tips { margin: 0 0 18px; padding-left: 1.2em; display: grid; gap: 8px; color: var(--muted); line-height: 1.6; font-size: .92rem; word-break: keep-all; }
.ttg-btns { display: flex; justify-content: flex-end; gap: 10px; }
@media (max-width: 600px) { .ttg-tag.c { left: 12px; bottom: 12px; } .ttg-tag.a, .ttg-tag.b { bottom: 40px; } .ttg-tag.b { left: 84px; } .ttg-sheet { padding-bottom: 76px; } }
.d-setup .d-guide { margin: 12px 0 0; justify-self: start; text-align: left; }
.st-row .link { display: block; margin-top: 6px; font-size: .84rem; }
@media (max-width: 600px) {   /* 스마트폰: 엑셀 그림이 옆으로 밀리지 않고 한 화면에 다 들어오게 */
  .ttg-sheet table { min-width: 0; font-size: .64rem; } .ttg-sheet td, .ttg-sheet th { padding: 4px 1px; } .ttg-sheet .ttg-dim { display: none; } .ttg-title { font-size: .78rem; }
  .ttg-btns .btn { flex: 1; justify-content: center; }
}
.ttg-drop { display: grid; justify-items: center; gap: 8px; margin: 0 0 16px; padding: 20px 16px; border: 2px dashed var(--line); border-radius: 18px; text-align: center; transition: background-color .2s ease, border-color .2s ease; } .ttg-drop b { font-weight: 500; } .ttg-drop span { color: var(--muted); font-size: .86rem; }
.ttg-drop.over { background: var(--surface); border-color: var(--text); }
@media (hover: none) { .ttg-dd { display: none; } .ttg-drop { padding: 14px; } }   /* 터치 기기는 끌어다 놓을 수 없으니 버튼만 */
@media (max-width: 360px) { .sw-plan .dp-b { padding: 11px 24px 11px 10px; grid-template-columns: 2.9em minmax(0, 1fr); gap: 4px; font-size: .88rem; background-position: right 8px center; } .sw-plan .dp-w { font-size: .8rem; } }   /* 아주 좁은 폰(320px)에서도 "10/26 다음 주"가 잘리지 않게 */
