/* 잇쇼니 수업 포털 화면 모양. PC와 휴대폰을 같은 파일로 그린다(760px보다 좁으면 휴대폰 배치). */
:root {
  --bg: #f4f5f8; --card: #fff; --line: #dfe2ea; --text: #1d2433; --muted: #667085;
  --brand: #2563eb; --brand-dark: #1d4ed8; --brand-soft: #e6efff;
  --ok: #1a7f4b; --ok-soft: #e3f4ea; --warn: #a15c00; --warn-soft: #fdf1dc; --danger: #b3261e; --danger-soft: #fbe9e7;
  --radius: 10px; --gap: 12px;
  font-size: 15px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif; line-height: 1.5; }
body.has-dialog { overflow: hidden; }
body.busy { cursor: progress; }
h1 { font-size: 1.35rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0; }
h3 { font-size: .95rem; margin: 0 0 6px; }
p { margin: 0 0 8px; }
ul, ol { margin: 0 0 8px; padding-left: 20px; }
a { color: var(--brand); }
small { font-weight: 400; }
[hidden] { display: none !important; }

.loading { padding: 48px 16px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.big { font-size: 1.15rem; font-weight: 700; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; word-break: break-all; }
.center { text-align: center; }
.no { color: var(--danger); }
.link { background: none; border: 0; padding: 0; color: var(--brand); text-decoration: underline; cursor: pointer; font: inherit; }

/* 틀 */
/* 위쪽 띠: 흰 바탕에 로고를 원래 색 그대로 둔다. 띠·메뉴·본문의 왼쪽 끝을 같은 선(24px)에 맞춘다 */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: var(--gap); padding: 18px 24px; background: var(--card); color: var(--text); border-bottom: 1px solid #eef0f5; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { display: block; width: auto; }
.brand-mark { height: 30px; }
.brand-word { height: 21px; }
.logo { margin: 4px 0 0; text-align: center; }
.logo img { max-width: 100%; height: auto; }
.who { font-size: .95rem; }
.who small { color: var(--muted); margin-left: 4px; }
.menu { display: flex; gap: 2px; overflow-x: auto; background: var(--card); border-bottom: 1px solid var(--line); padding: 0 12px; position: sticky; top: 0; z-index: 5; }
.menu a { flex: none; padding: 11px 12px; color: var(--text); text-decoration: none; border-bottom: 3px solid transparent; white-space: nowrap; }
.menu a.on { border-bottom-color: var(--brand); color: var(--brand); font-weight: 700; }
.main { padding: 20px 24px; }
.foot { padding: 16px; text-align: center; color: var(--muted); font-size: .8rem; }
.page { max-width: 1040px; margin: 0 auto; }
.page.narrow { max-width: 520px; }
.page.wide { max-width: 1400px; }
.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--gap); margin-bottom: 14px; }
.back { display: block; font-size: .85rem; text-decoration: none; margin-bottom: 2px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--gap); margin-bottom: 10px; }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-dark); font-size: .8rem; font-weight: 700; text-align: center; }
.row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.row > .field { flex: 1 1 150px; }

/* 버튼과 입력 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 36px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); font: inherit; font-size: .92rem; text-decoration: none; cursor: pointer; }
.btn:hover { background: #f1f3f8; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { border-color: #e2b4b0; color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: #eceff5; }
.btn.kakao { background: #fee500; border-color: #fee500; color: #191600; font-weight: 700; }
.icon-btn { border: 0; background: none; font-size: 1.1rem; line-height: 1; padding: 6px 8px; cursor: pointer; color: var(--muted); text-decoration: none; border-radius: 6px; }
.icon-btn:hover { background: #eceff5; }
:focus-visible { outline: 3px solid #8fb0f0; outline-offset: 1px; }

.form { display: grid; gap: 10px; }
.form > .btn, .form > .preview > .btn { justify-self: start; min-width: 120px; }
.page.narrow .form > .btn, .panel .form > .btn, .panel .preview > .btn { justify-self: stretch; }
.field { display: grid; gap: 4px; min-width: 0; align-content: start; }
.field-label { font-size: .85rem; font-weight: 600; color: #3b4456; padding: 0; }
.input { width: 100%; min-height: 38px; padding: 7px 10px; border: 1px solid #c6ccd9; border-radius: 8px; background: #fff; color: var(--text); font: inherit; }
textarea.input { resize: vertical; }
.hint { color: var(--muted); font-size: .82rem; margin: 0; }
.form-error { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.inline { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; }
.inline .input { width: auto; min-width: 120px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
fieldset.choices { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.choice { display: flex; gap: 8px; align-items: flex-start; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.choice.off { opacity: .55; cursor: not-allowed; }
.choice.small { padding: 4px 8px; font-size: .88rem; }
.choice input { margin-top: 4px; }
.pass-line { display: block; font-size: .85rem; color: var(--muted); }
.checks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; background: #eceff5; color: #3b4456; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.badge.ok, .badge.used, .badge.done { background: var(--ok-soft); color: var(--ok); }
.badge.warn, .badge.cancel_review, .badge.open { background: var(--warn-soft); color: var(--warn); }
.badge.info, .badge.reserved { background: var(--brand-soft); color: var(--brand-dark); }
.badge.cancelled_charged, .badge.rejected { background: var(--danger-soft); color: var(--danger); }
.empty { color: var(--muted); margin: 4px 0; }
.note { margin: 8px 0; padding: 8px 10px; border-radius: 8px; background: #f1f3f8; font-size: .9rem; }
.note.warn { background: var(--warn-soft); color: #6b3d00; }
.note.danger { background: var(--danger-soft); color: var(--danger); font-weight: 700; }
.note.ok { background: var(--ok-soft); color: #0f5a33; }

.table-wrap { overflow-x: auto; margin-bottom: 8px; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .8rem; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 8px; border-bottom: 1px solid #eef0f5; vertical-align: top; }
.table td:first-child { white-space: nowrap; }
.nowrap { white-space: nowrap; }
.plans { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.plan { display: grid; gap: 1px; padding: 7px 9px; border-radius: 6px; background: #fff; border: 1px solid #dfe5f3; font-size: .9rem; }
.plan.changed { background: var(--warn-soft); border-color: #ecd09b; }
.dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 16px; margin: 0 0 12px; }
.dl dt { font-size: .8rem; color: var(--muted); }
.dl dd { margin: 0; font-weight: 600; }
.list { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 10px; }
.list.plain { gap: 4px; }
.list.plain li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 4px 0; }
.item { display: grid; gap: 5px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.fold { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-top: 10px; }
.fold > summary { cursor: pointer; font-weight: 700; padding: 2px 0; }
.fold[open] > summary { margin-bottom: 10px; }
.checks span { display: inline-block; margin-right: 8px; font-weight: 600; }
.checks .yes { color: var(--ok); }
.checks .no { color: var(--danger); }
.chip, .chip-btn { display: inline-block; padding: 1px 8px; margin: 1px 0; border-radius: 10px; background: #eceff5; font-size: .82rem; border: 0; color: var(--text); font-family: inherit; }
.chip-btn { cursor: pointer; background: var(--brand-soft); color: var(--brand-dark); }
.chip.group { background: #efe7fb; color: #4b2a8a; }

/* 학생 화면 */
.lesson, .pass { padding: 12px; border: 1px solid var(--line); border-radius: 8px; display: grid; gap: 6px; }
.lesson-when { font-weight: 700; font-size: 1.05rem; }
.pass-name { font-weight: 700; }
.past { justify-content: flex-start; font-size: .92rem; }
.result-used { color: var(--danger); font-weight: 600; }
.pass-valid { color: var(--brand); }
.phone-frame { max-width: 420px; margin: 0 auto; padding: 12px; border: 2px solid var(--line); border-radius: 18px; background: var(--bg); }

/* 로그인·설정 */
.steps { padding-left: 20px; display: grid; gap: 14px; }
.qr-box { width: 220px; max-width: 100%; margin: 8px 0; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.qr { display: block; width: 100%; height: auto; }
.secret { font-size: 1.05rem; letter-spacing: .5px; padding: 8px 10px; background: #f1f3f8; border-radius: 8px; }
.codes { list-style: none; padding: 12px; margin: 8px 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; background: #f1f3f8; border-radius: 8px; font-size: 1.05rem; }
.confirm-code { font-size: 2.4rem; font-weight: 800; letter-spacing: 6px; margin: 14px 0; color: var(--brand-dark); }

/* 캘린더 */
.cal-head h1 { min-width: 150px; text-align: center; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg a { padding: 7px 12px; text-decoration: none; color: var(--text); font-size: .9rem; }
.seg a.on { background: var(--brand); color: #fff; font-weight: 700; }
.cal-layout { display: grid; gap: 14px; align-items: start; }
.cal-layout.with-panel { grid-template-columns: minmax(0, 1fr) 360px; }
.days { display: grid; gap: 6px; }
.days-7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.day { background: var(--card); border: 1px solid var(--line); border-radius: 8px; display: flex; flex-direction: column; min-height: 220px; }
.day.today { border-color: var(--brand); box-shadow: inset 0 3px 0 var(--brand); }
.day.picked { background: #fbfcff; border-style: dashed; border-color: var(--brand); }
.day-head { padding: 7px 8px; border-bottom: 1px solid #eef0f5; font-size: .9rem; }
.day-head span { color: var(--muted); }
.day-body { flex: 1; display: grid; gap: 5px; align-content: start; padding: 6px; }
.add { margin: 0 6px 6px; padding: 5px; border: 1px dashed #c6ccd9; border-radius: 6px; text-align: center; text-decoration: none; color: var(--muted); font-size: .85rem; }
.add:hover { border-color: var(--brand); color: var(--brand); }
.cls { display: grid; gap: 1px; width: 100%; padding: 6px 7px; border: 1px solid #cfd8ee; border-left: 4px solid var(--brand); border-radius: 6px; background: #f6f8fd; color: var(--text); font: inherit; font-size: .86rem; text-align: left; text-decoration: none; cursor: pointer; }
.cls:hover { background: var(--brand-soft); }
.cls-time { font-weight: 700; }
.cls-name small { color: var(--muted); }
.cls-meta { color: var(--muted); font-size: .8rem; }
.cls.group { border-left-color: #7a4fc9; background: #f7f3fd; border-color: #ddd0f3; }
.cls.live { border-left-color: var(--warn); background: var(--warn-soft); }
.cls.used { border-left-color: var(--ok); background: #f3faf6; border-color: #cfe8da; }
.cls.review { border-left-color: var(--danger); background: var(--danger-soft); }
.cls.muted { border-left-color: #9aa3b5; background: #f4f5f8; }
.month { background: var(--card); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.month-head, .month-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.month-head span { padding: 6px; text-align: center; font-size: .8rem; color: var(--muted); border-bottom: 1px solid var(--line); }
.month-cell { position: relative; min-height: 92px; padding: 5px; border-right: 1px solid #eef0f5; border-bottom: 1px solid #eef0f5; display: grid; gap: 2px; align-content: start; color: var(--text); font-size: .8rem; overflow: hidden; }
.month-cell:hover { background: #f6f8fd; }
.month-cell.out { background: #fafbfc; color: #a2a9b8; }
.month-cell.today b { display: inline-block; width: 22px; height: 22px; line-height: 22px; text-align: center; border-radius: 50%; background: var(--brand); color: #fff; }
.month-cell.picked { box-shadow: inset 0 0 0 2px var(--brand); }
/* 날짜 칸 전체가 "이 날짜 고르기"다. 수업 줄은 그 위에 떠 있어서 따로 눌린다 */
.month-date { justify-self: start; text-decoration: none; color: inherit; }
.month-date::after { content: ''; position: absolute; inset: 0; }
.month-cell .chip { position: relative; z-index: 1; display: block; width: 100%; margin: 0; text-align: left; text-decoration: none; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.month-cell .chip:hover { filter: brightness(.95); }
.month-cell .chip.used { background: #e3f3ea; color: #1d5c3a; }
.month-cell .chip.live { background: var(--warn-soft); }
.month-cell .chip.review { background: var(--danger-soft); }
.month-cell .chip.muted { background: transparent; text-decoration: line-through; }
.month-more { position: relative; }
.month-count { display: none; }
.agenda { margin-top: 12px; padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
.agenda-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.agenda-head h2 { margin: 0; font-size: 1.05rem; }
.agenda-body { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.panel { position: sticky; top: 56px; margin: 0; }
.preview, .judge { margin-top: 10px; padding: 10px; border-radius: 8px; background: #f6f8fd; border: 1px solid #cfd8ee; display: grid; gap: 6px; }
.judge.charged { background: var(--danger-soft); border-color: #e2b4b0; }
.judge.review { background: var(--warn-soft); border-color: #ecd09b; }
.lesson-head { margin-bottom: 10px; }

/* 창 */
.overlay { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 12px; background: rgba(20, 26, 40, .5); overflow-y: auto; }
.overlay.top { z-index: 30; }
.dialog { width: 100%; max-width: 520px; background: var(--card); border-radius: 12px; box-shadow: 0 12px 40px rgba(0, 0, 0, .25); }
.dialog.wide { max-width: 680px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.dialog-body { padding: 16px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 40; max-width: min(92vw, 560px); padding: 10px 16px; border-radius: 10px; background: #1d2433; color: #fff; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); }

/* PC와 휴대폰에서 다르게 보이는 것 */
/* 휴대폰에서만 보이는 칸: PC에서만 숨긴다(휴대폰에서는 원래 display를 그대로 쓴다) */
@media (min-width: 761px) { .mobile-only { display: none !important; } }
.pcards { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pcard { display: grid; gap: 4px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--text); text-decoration: none; }
.pcard.tap:active { background: var(--brand-soft); }
.pcard-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.panel .pcards { max-height: calc(100vh - 220px); overflow-y: auto; }
.time-box { display: flex; gap: 6px; align-items: stretch; }
.time-box .input { flex: 1; min-width: 0; text-align: center; font-size: 1.05rem; letter-spacing: .02em; }
.btn.step { flex: none; min-width: 44px; padding: 0 10px; font-size: 1rem; }
fieldset.chips { display: flex; flex-wrap: wrap; gap: 6px; }
/* 관리자 기간 변경 창(2026-11-15) */
.period-box { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fafbfd; }
.period-now { margin: 0; }
.period-preview { margin: 0; font-weight: 700; color: var(--brand-dark); }
.period-preview.shrink { color: var(--danger); }
.teacher-pick { display: none; }
form:has(input[name="reasonKind"][value="teacher"]:checked) .teacher-pick { display: block; }
.filters { margin-bottom: 8px; }
fieldset.chips legend { width: 100%; margin-bottom: 4px; }
fieldset.chips .choice { align-items: center; }
fieldset.chips .choice input { margin-top: 0; }
.pcard-go { justify-self: end; color: var(--brand-dark); font-weight: 700; font-size: .9rem; }
.cal-fab { position: fixed; right: 16px; bottom: 20px; z-index: 5; display: grid; justify-items: end; gap: 8px; }
.cal-fab .btn, .cal-fab .seg { box-shadow: 0 4px 14px rgba(0, 0, 0, .18); }

/* 휴대폰 */
@media (max-width: 760px) {
  .desk-only { display: none !important; }
  /* 등록창이 열리면 맨 위에 둔다. 그 아래에 고른 날짜의 수업 목록이 이어진다 */
  .cal-layout.with-panel:not(.side-pending) .panel { order: -1; }
  .cal-main { padding-bottom: 96px; }
  :root { font-size: 16px; }
  .topbar { padding: 14px 16px; }
  .brand-mark { height: 26px; }
  .brand-word { height: 18px; }
  .menu { padding: 0 4px; }
  .main { padding: 12px 16px; }
  .card { padding: 12px; }
  .cal-layout.with-panel { grid-template-columns: 1fr; }
  .cal-layout.side-pending { grid-template-columns: minmax(0, 1fr); }
  .days-7 { grid-template-columns: 1fr; }
  .day { min-height: 0; }
  .panel { position: static; }
  .cal-head h1 { min-width: 0; font-size: 1.1rem; }
  .cal-head .row { gap: 4px; }
  .cal-head .btn.ghost { padding: 6px 8px; }
  .month-cell { min-height: 54px; padding: 4px 2px; justify-items: center; }
  .month-date { justify-self: center; }
  .month-cell .chip, .month-more { display: none; }
  .month-count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--brand-soft); color: var(--brand-dark); font-size: .72rem; font-weight: 700; text-align: center; }
  .agenda-body { grid-template-columns: 1fr; }
  /* 등록창이 열리면 달력은 접는다(고른 날짜의 수업과 등록창이 바로 이어지게) */
  /* 등록창이 열렸을 때만 달력을 접는다(대기 수강권 칸은 휴대폰에서 숨기므로 접지 않는다) */
  .cal-layout.with-panel:not(.side-pending) .month { display: none; }
  .overlay { padding: 0; align-items: flex-end; }
  .dialog, .dialog.wide { max-width: none; border-radius: 14px 14px 0 0; max-height: 92vh; overflow-y: auto; }
  .btn { min-height: 42px; }
  /* 시간·날짜 칸과 고르기 칸의 높이를 맞춰 같은 줄에서 어긋나지 않게 */
  input.input:not([type=checkbox]):not([type=radio]), select.input { height: 44px; min-height: 44px; padding-top: 0; padding-bottom: 0; }
  .codes { grid-template-columns: 1fr; }
}

/* 이 기기 기억하기(2026-11-17) */
.choice.remember { margin-top: 4px; }
