@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700;900&display=swap');

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  background: #eef1f5;
}

/* ── 툴바 ── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #2c3e50;
  padding: 10px 24px;
  height: 52px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.toolbar-left { display: flex; align-items: center; gap: 12px; }
.toolbar-right { display: flex; align-items: center; gap: 10px; }
.sel-year, .sel-month {
  background: #3d5166;
  border: none;
  color: #ecf0f1;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
}
.sel-year { min-width: 80px; }
.sel-month { min-width: 60px; }
.sel-year:hover, .sel-month:hover { background: #4a6278; }
.btn-load {
  background: #3498db; color: #fff; border: none;
  padding: 8px 20px; border-radius: 6px;
  font-family: inherit; font-size: 0.92rem; font-weight: 700; cursor: pointer;
}
.btn-load:disabled { opacity: 0.4; cursor: default; }
.btn-load:not(:disabled):hover { opacity: 0.85; }
.btn-print {
  background: #27ae60; color: #fff; border: none;
  padding: 8px 20px; border-radius: 6px;
  font-family: inherit; font-size: 0.92rem; font-weight: 700; cursor: pointer;
}
.btn-print:disabled { opacity: 0.4; cursor: default; }
.btn-print:not(:disabled):hover { opacity: 0.85; }
.btn-secondary {
  background: #fff; color: #2c3e50; border: none;
  padding: 7px 16px; border-radius: 6px;
  font-family: inherit; font-size: 0.88rem; font-weight: 700; cursor: pointer;
}
.user-info { font-size: 0.82rem; color: #95a5a6; }

/* ── 달력 페이지 ── */
.page {
  height: calc(100vh - 52px);
  max-width: 1100px;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 2px 16px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  padding: 16px 20px 10px;
}

/* ── 헤더 ── */
.cal-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  border-bottom: 2.5px solid #222;
  padding-bottom: 6px;
  margin-bottom: 0;
  flex-shrink: 0;
}
.month-title {
  font-size: 4rem; font-weight: 900; color: #111;
  line-height: 1; letter-spacing: -2px;
}
.print-date { font-size: 0.68rem; color: #bbb; padding-bottom: 4px; }

/* ── 테이블 ── */
table {
  width: 100%; border-collapse: collapse;
  table-layout: fixed; flex: 1; height: 0;
}

thead th {
  font-size: 0.82rem; font-weight: 500; color: #888;
  padding: 6px 0 5px;
  text-align: left;
  padding-left: 8px;
  border-bottom: 1px solid #ddd;
}
thead th.sat-hd { color: #2471a3; }

/* ── 날짜 셀 ── */
tbody { height: 100%; }
tbody tr { height: calc(100% / var(--week-count, 5)); }

td.day-cell {
  vertical-align: top;
  border-right: 1px solid #e0e0e0;
  border-bottom: 1px solid #e0e0e0;
  padding: 7px 8px 5px;
  background: #fff;
}
td.day-cell:first-child { border-left: 1px solid #e0e0e0; }
tbody tr:first-child td { border-top: 1px solid #e0e0e0; }

td.empty {
  border-right: 1px solid #e0e0e0;
  border-bottom: 1px solid #e0e0e0;
  background: #fafafa;
}
td.empty:first-child { border-left: 1px solid #e0e0e0; }
td.saturday { background: #f8faff; }

/* ── 날짜 숫자 ── */
.day-num {
  font-size: 1.4rem; font-weight: 900; color: #111;
  line-height: 1; margin-bottom: 5px;
}
td.saturday .day-num { color: #2471a3; }

/* ── 공휴일 ── */
.holiday {
  font-size: 0.72rem; font-weight: 600;
  color: #c0392b;
  margin-bottom: 4px;
  line-height: 1.2;
}

/* ── 이벤트 ── */
.events { display: flex; flex-direction: column; gap: 3px; }
.event {
  font-size: 0.78rem; font-weight: 500;
  color: #333;
  line-height: 1.3;
  padding-left: 8px;
  border-left: 3px solid #aaa;
  word-break: keep-all;
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.event-time {
  font-size: 0.68rem;
  font-weight: 700;
  color: #888;
  white-space: nowrap;
  flex-shrink: 0;
}

/* 더보기(+N) — 모바일에서만 표시 */
.event-more { display: none; }

/* 날짜 클릭 */
td.day-cell { cursor: pointer; }
td.day-cell:hover { background: #f7f9fc !important; }

/* 일정 뱃지 (수업과 구분) */
.cal-event {
  font-size: 0.74rem; font-weight: 500;
  background: #fffde7;
  border: 1px solid #f9ca24;
  color: #7d5a00;
  border-radius: 9px;
  padding: 1px 7px;
  word-break: keep-all;
  line-height: 1.4;
}

/* ── 날짜 팝업 ── */
.day-popup {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
  width: 300px;
  z-index: 400;
}
.day-popup-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid #eee;
}
.day-popup-header span { font-size: 0.95rem; font-weight: 700; color: #2c3e50; }
.day-popup-close {
  background: none; border: none; font-size: 0.9rem;
  color: #bbb; cursor: pointer; padding: 2px 6px; border-radius: 4px;
}
.day-popup-close:hover { color: #555; background: #f0f0f0; }
#day-popup-list { padding: 8px 16px; max-height: 260px; overflow-y: auto; }
.popup-event-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 0; border-bottom: 1px solid #f5f5f5; gap: 8px;
}
.popup-event-item:last-child { border-bottom: none; }
.popup-event-title { font-size: 0.85rem; color: #222; font-weight: 500; }
.popup-event-time { font-size: 0.75rem; color: #999; margin-top: 1px; }
.popup-class-info { border-left: 3px solid #aaa; padding-left: 9px; }
.popup-event-del {
  background: none; border: none; color: #ddd;
  cursor: pointer; font-size: 0.9rem; padding: 2px 4px;
  flex-shrink: 0; border-radius: 4px;
}
.popup-event-del:hover { color: #c0392b; background: #fff0f0; }
.day-popup-form {
  display: flex; flex-direction: column; gap: 7px;
  padding: 10px 16px 14px;
  border-top: 1px solid #eee;
}
.day-popup-form input {
  border: 1.5px solid #dde1e7; border-radius: 7px;
  padding: 7px 10px; font-family: inherit; font-size: 0.85rem;
  outline: none; width: 100%;
}
.day-popup-form input:focus { border-color: #2c3e50; }
.day-popup-add {
  background: #2c3e50; color: #fff; border: none;
  border-radius: 7px; padding: 8px; font-family: inherit;
  font-size: 0.88rem; font-weight: 700; cursor: pointer; margin-top: 2px;
}
.day-popup-add:hover { opacity: 0.88; }

/* ── 세그먼트 탭 ── */
.toolbar-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,0.1);
  padding: 4px;
  border-radius: 8px;
}
.toolbar { position: relative; }
.seg-btn {
  background: transparent;
  border: none;
  color: #aab;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 6px 18px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.seg-btn.active {
  background: #fff;
  color: #2c3e50;
}
.seg-btn:not(.active):hover { color: #ecf0f1; }
.gcal-icon { display: inline-flex; vertical-align: middle; margin-right: 4px; }

/* ── 시간표 ── */
.tt-wrap {
  flex: 1;
  overflow-y: auto;
  margin-top: 10px;
}
#tt-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
#tt-table thead th {
  background: #2c3e50;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 10px 6px;
  text-align: center;
  letter-spacing: 1px;
  border: 1px solid #3d5166;
}
#tt-table thead th.tt-sat { background: #4a3728; }
#tt-table thead th.tt-name { background: #1a252f; text-align: left; padding-left: 12px; }

#tt-table tbody tr:nth-child(even) { background: #f8f9fb; }
#tt-table tbody tr:nth-child(odd)  { background: #fff; }

#tt-table td {
  border: 1px solid #b9c2cd;
  padding: 12px 8px;
  text-align: center;
  font-size: 0.85rem;
  vertical-align: middle;
}
#tt-table td.tt-class-name {
  text-align: left;
  padding-left: 14px;
  font-weight: 700;
  font-size: 0.92rem;
  border-left: 5px solid;
  color: #222;
}
.tt-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* ── 시간표 페이지 (캔바 스타일 배경) ── */
.tt-page {
  height: calc(100vh - 52px);
  display: flex;
  align-items: stretch;
}
.tt-bg {
  flex: 1;
  background: #fdf3ee;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: visible;
}

/* 상단 영역 - 월 제목 + 밑줄 */
.tt-top-area {
  padding: 36px 60px 0;
  flex-shrink: 0;
}
.tt-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.side-nav-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 200;
  width: 44px;
  height: 120px;
  background: rgba(0,0,0,0.08);
  border: none;
  border-radius: 0 10px 10px 0;
  font-size: 2.2rem;
  color: rgba(0,0,0,0.25);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s, color 0.2s;
  user-select: none;
}
.side-nav-next {
  right: 0;
  border-radius: 10px 0 0 10px;
}
.side-nav-prev { left: 0; }
.side-nav-btn:hover {
  opacity: 1 !important;
  background: rgba(0,0,0,0.18);
  color: #fff;
}
body:hover .side-nav-btn { opacity: 0.45; }
.btn-export-gcal {
  display: flex;
  align-items: center;
  gap: 7px;
  background: #fff;
  border: 1.5px solid #dadce0;
  border-radius: 8px;
  padding: 10px 18px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: #3c4043;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  white-space: nowrap;
  margin-top: 8px;
}
.btn-export-gcal:hover { background: #f8f9fa; }
.btn-export-gcal:disabled { opacity: 0.5; cursor: default; }
.tt-month-title {
  font-size: 1.6rem;
  font-weight: 900;
  color: #3b2a1a;
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 8px;
}
.tt-underline {
  width: 100%;
  max-width: 200px;
  height: 3px;
  background: #3b2a1a;
  margin-bottom: 24px;
}

/* 그리드 영역 */
.tt-grid-area {
  flex: 1;
  padding: 0 32px 32px 32px;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#tt-table {
  flex: 1;
  height: 0;
  min-height: 500px;
}
#tt-table tbody { height: 100%; }
#tt-table tbody tr { height: calc(100% / var(--slot-count, 10)); }

/* 테이블 */
#tt-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: #fff;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 8px rgba(0,0,0,0.10);
}
#tt-table thead th {
  background: #2c3e50;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 12px 6px;
  text-align: center;
  letter-spacing: 1px;
  border-right: 1px solid #3d5166;
}
#tt-table thead th:last-child { border-right: none; }
#tt-table thead th.tt-sat { background: #2c3e50; }
#tt-table thead th.tt-time-col {
  width: 110px;
  background: #2c3e50;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
}

#tt-table tbody tr { border-bottom: 1px solid #b9c2cd; height: 60px; }
#tt-table tbody tr:last-child { border-bottom: none; }
#tt-table tbody tr { background: #fff; }

#tt-table td {
  padding: 8px;
  text-align: center;
  font-size: 0.88rem;
  color: #333;
  vertical-align: middle;
  border-right: 1px solid #b9c2cd;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}
#tt-table td:last-child { border-right: none; }

#tt-table td.tt-time-col {
  font-size: 0.78rem;
  color: #555;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  background: #fffbe6;
  border-right: 1px solid #e8e8e8;
  overflow: hidden;
}
.tt-time-short { display: none; }

.tt-lunch-row { background: #f0eaff !important; }
.tt-lunch-row td { background: #f0eaff !important; }
.tt-lunch-row td.tt-time-col { background: #e8e0f5 !important; color: #6650a4; }
.tt-lunch-cell {
  text-align: center;
  font-size: 0.88rem;
  font-weight: 600;
  color: #6650a4;
  letter-spacing: 2px;
  padding: 12px 8px;
  border-right: none;
}

.tt-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  display: inline-block;
  opacity: 0.85;
}

/* 시간표 셀 내 강의 카드 — 카드가 셀을 시간 비율대로 꽉 채움 */
#tt-table td.tt-class-cell {
  position: relative;
  padding: 0;
  overflow: hidden;
  text-align: left;
}
.tt-cell-fill {
  position: absolute;
  inset: 0;
}
.tt-class-card {
  position: absolute;
  box-sizing: border-box;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 5px;
  padding: 3px 6px;
  border: 1px solid rgba(0,0,0,0.10);
  overflow: hidden;
  cursor: pointer;
  transition: filter 0.12s;
}
.tt-class-card:hover {
  filter: brightness(0.94);
}
.tt-card-name {
  font-weight: 600;
  color: #222;
  font-size: 0.82rem;
  line-height: 1.25;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.tt-card-instr {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  color: #fff;
  border-radius: 3px;
  padding: 1px 4px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 0;
}

/* 하단 바 제거 */
.tt-bottom-bar { display: none; }

/* ── 인쇄: 시간표 ── */
@page timetable { size: A4 landscape; margin: 8mm 10mm; }

@media print {
  .btn-export-gcal { display: none !important; }

  .tt-page {
    page: timetable;
    height: 194mm;
    page-break-inside: avoid;
  }
  .tt-bg { height: 100%; background: #fff; }
  .tt-top-area { padding: 28px 50px 0; }
  .tt-top-row { align-items: center; }
  .tt-month-title { font-size: 3.8rem; letter-spacing: -2px; margin-bottom: 14px; color: #2c3e50; }
  .tt-underline { background: #2c3e50; width: 160px; }
  .tt-grid-area {
    padding: 0 32px;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  #tt-table {
    flex: 1;
    height: 0;
  }
  #tt-table tbody { height: 100%; }
  #tt-table tbody tr { height: calc(100% / var(--slot-count, 10)); }
  .tt-bottom-bar { display: none; }

  #tt-table thead th {
    background: #2c3e50 !important;
    color: #fff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  #tt-table thead th.tt-time-col {
    background: #1a252f !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  #tt-table td.tt-time-col {
    background: #fef9e7 !important;
    color: #555 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .tt-lunch-row td { background: #f0eaff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .tt-lunch-row td.tt-time-col { background: #e8e0f5 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .tt-lunch-cell { color: #6650a4 !important; }
  #tt-table tbody tr:nth-child(even) { background: #fafafa !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ── 입력 페이지 ── */
.input-page {
  height: calc(100vh - 52px);
  overflow-y: auto;
  background: #eef1f5;
  padding: 24px;
}
.input-page-inner {
  max-width: 800px;
  margin: 0 auto;
}
.input-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.input-page-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #2c3e50;
}
.btn-add-class {
  background: #2c3e50;
  color: #fff;
  border: none;
  padding: 10px 22px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
}
.btn-add-class:hover { opacity: 0.85; }

/* 수업 카드 */
.class-card {
  background: #fff;
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 12px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.class-card-color {
  width: 5px;
  border-radius: 4px;
  align-self: stretch;
  flex-shrink: 0;
}
.class-card-body { flex: 1; }
.class-card-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 2px;
}
.class-card-instructor {
  font-size: 0.82rem;
  color: #888;
  margin-bottom: 8px;
}
.class-card-schedules { display: flex; flex-wrap: wrap; gap: 6px; }
.schedule-tag {
  background: #f0f2f5;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.78rem;
  color: #444;
  font-weight: 500;
}
.class-card-actions { display: flex; gap: 8px; align-items: center; }
.btn-card-edit, .btn-card-delete {
  background: none;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 5px 12px;
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  color: #555;
}
.btn-card-delete { color: #c0392b; border-color: #f5c6c6; }
.btn-card-edit:hover { background: #f5f5f5; }
.btn-card-delete:hover { background: #fff0f0; }

/* 구글 캘린더 참고 */
.gcal-ref-section {
  margin-top: 32px;
  background: #fff;
  border-radius: 10px;
  padding: 18px 20px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}
.gcal-ref-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 12px;
}
.gcal-ref-sub { font-weight: 400; color: #aaa; font-size: 0.8rem; }
.gcal-ref-empty { font-size: 0.82rem; color: #bbb; }
.btn-gcal-login {
  background: #fff;
  border: 1.5px solid #dde1e7;
  border-radius: 8px;
  padding: 9px 20px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: #2c3e50;
  cursor: pointer;
}
.btn-gcal-login:hover { background: #f5f7fa; }
#gcal-ref-list { display: flex; flex-wrap: wrap; gap: 8px; }
.gcal-ref-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f5f7fa;
  border-radius: 20px;
  padding: 6px 14px;
  border: 1px solid #e0e4ea;
}
.gcal-ref-name { font-size: 0.85rem; font-weight: 600; color: #2c3e50; }
.gcal-ref-days { font-size: 0.78rem; color: #888; }

.class-filter-bar {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.class-filter-tabs {
  display: flex;
  gap: 6px;
}
.filter-tab {
  background: #fff;
  border: 1.5px solid #dde1e7;
  border-radius: 20px;
  padding: 6px 16px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: #888;
  cursor: pointer;
}
.filter-tab.active {
  background: #2c3e50;
  border-color: #2c3e50;
  color: #fff;
}
.filter-tab:not(.active):hover { background: #f0f2f5; }

/* 하위 분류 태그 */
.sub-filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-left: 2px;
}
.sub-tag {
  background: #f0f2f5;
  border: 1.5px solid #e0e4ea;
  border-radius: 20px;
  padding: 4px 14px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: #555;
  cursor: pointer;
}
.sub-tag.active {
  background: #e8f0fe;
  border-color: #4285f4;
  color: #1a56c4;
}
.sub-tag:not(.active):hover { opacity: 0.8; }

/* 태그 선택기 (모달 입력) */
.tag-selector-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}
.tag-selector-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 0;
}
.tag-selector-chips:empty { display: none; }
.tag-chip {
  border-radius: 14px;
  padding: 3px 11px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s;
  line-height: 1.4;
}
.tag-chip:hover { opacity: 0.8; }
.tag-chip.selected { box-shadow: 0 0 0 2px rgba(0,0,0,0.15); }

/* 카드 태그 */
.class-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border-radius: 20px;        /* 기본: pill (강사) */
  padding: 3px 9px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
}
/* 강사 태그 - pill 모양 유지 */
.tag-instr { border-radius: 20px; }

/* 기관 태그 - 둥근 사각형, 고정 회색 */
.tag-org {
  border-radius: 5px;
  background: #eef0f2;
  color: #555;
  border: 1px solid #ccc;
  font-weight: 500;
}

/* 태그 앞 구분 라벨 */
.tag-prefix {
  font-size: 0.62rem;
  font-weight: 500;
  opacity: 0.65;
  margin-right: 5px;
  padding-right: 5px;
  border-right: 1px solid currentColor;
  line-height: 1;
}

.tag-date {
  background: #f5f5f5;
  color: #777;
  font-weight: 500;
  border-radius: 4px;
}

.class-group-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 8px 4px 4px;
  margin-top: 8px;
  border-bottom: 1px solid #e8e8e8;
  margin-bottom: 8px;
}

.class-list-empty {
  text-align: center;
  color: #aaa;
  font-size: 0.95rem;
  padding: 48px 0;
}

/* ── 모달 ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.modal-box {
  position: relative;
  background: #fff;
  border-radius: 14px;
  padding: 28px 32px;
  width: 520px;
  max-width: 95vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
}
.modal-close-x {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  font-size: 1.05rem;
  line-height: 1;
  color: #888;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close-x:hover { background: #f0f2f5; color: #333; }
.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 20px;
}
.modal-field {
  margin-bottom: 14px;
}
.modal-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #666;
  margin-bottom: 5px;
}
.modal-field input {
  width: 100%;
  border: 1.5px solid #dde1e7;
  border-radius: 8px;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 0.92rem;
  outline: none;
}
.modal-field input:focus { border-color: #2c3e50; }
.date-range-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.date-range-row input[type="date"] {
  flex: 1;
  border: 1.5px solid #dde1e7;
  border-radius: 8px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
}
.date-range-row input[type="date"]:focus { border-color: #2c3e50; }
.modal-schedules-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #666;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.btn-add-schedule {
  background: none;
  border: 1.5px dashed #bbb;
  border-radius: 6px;
  padding: 3px 12px;
  font-family: inherit;
  font-size: 0.78rem;
  color: #888;
  cursor: pointer;
}
.btn-add-schedule:hover { border-color: #2c3e50; color: #2c3e50; }

/* 스케줄 행 */
.schedule-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8f9fb;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.day-checkboxes { display: flex; gap: 4px; }
.day-check-label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid #ddd;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  color: #555;
  transition: all 0.12s;
}
.day-check-label input { display: none; }
.day-check-label.checked {
  background: #2c3e50;
  border-color: #2c3e50;
  color: #fff;
}
.schedule-sep { color: #aaa; font-size: 0.85rem; }
.time-select {
  border: 1.5px solid #dde1e7;
  border-radius: 6px;
  padding: 5px 6px;
  font-family: inherit;
  font-size: 0.82rem;
  color: #333;
  background: #fff;
  cursor: pointer;
}
.btn-remove-schedule {
  background: none;
  border: none;
  color: #bbb;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 4px;
  margin-left: auto;
}
.btn-remove-schedule:hover { color: #c0392b; }

/* ── 강사 색상 선택 ── */
.instr-color-row {
  align-items: center;
  gap: 10px;
  padding: 2px 0 12px;
}
.instr-color-row > label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #666;
  white-space: nowrap;
  min-width: 30px;
}
.instr-color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.instr-color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  cursor: pointer;
  padding: 0;
  outline: none;
  transition: transform 0.12s, box-shadow 0.12s;
}
.instr-color-swatch:hover { transform: scale(1.2); }
.instr-color-swatch.selected {
  border-color: #fff;
  box-shadow: 0 0 0 2.5px #333;
  transform: scale(1.18);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}
.btn-modal-cancel {
  background: #f0f0f0;
  border: none;
  padding: 10px 22px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  color: #555;
}
.btn-modal-save {
  background: #2c3e50;
  color: #fff;
  border: none;
  padding: 10px 28px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}
.btn-modal-cancel:hover { background: #e5e5e5; }
.btn-modal-save:hover { opacity: 0.88; }

/* ── 시간표 개별 수업 작업 ── */
.tt-action-box { width: 460px; }
.tt-action-summary {
  background: #f6f8fb;
  border: 1px solid #e5e9ef;
  border-radius: 8px;
  padding: 10px 12px;
  margin: -6px 0 16px;
  font-size: 0.88rem;
  color: #34495e;
  font-weight: 600;
}
.tt-date-select {
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
}
.tt-action-status {
  min-height: 18px;
  margin-top: 7px;
  font-size: 0.78rem;
  color: #777;
  line-height: 1.35;
}
.tt-action-fixed-date {
  min-height: 0;
  margin: -6px 0 4px;
  color: #777;
}
.tt-action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
}
.tt-action-buttons button {
  width: 100%;
  padding: 9px 8px;
  font-size: 0.84rem;
  white-space: nowrap;
}
.btn-single-delete {
  background: #fff4f2;
  color: #c0392b;
  border: 1px solid #ffd2cb;
  padding: 10px 18px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}
.btn-single-delete:hover { background: #ffe9e5; }
.tt-replace-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #edf0f3;
}

/* ── 로딩 오버레이 ── */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.3);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px; color: #fff; font-size: 1rem; font-weight: 600;
  z-index: 999;
}
.spinner {
  width: 40px; height: 40px;
  border: 4px solid rgba(255,255,255,0.3);
  border-top-color: #fff; border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 인쇄 ── */
@media print {
  @page { size: A4 landscape; margin: 8mm 10mm; }
  html, body { height: 100%; background: #fff; }
  .no-print { display: none !important; }
  .page {
    height: 194mm;
    max-width: 100%;
    box-shadow: none;
    border-radius: 0;
    padding: 8px 10px 4px;
    margin: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    page-break-inside: avoid;
  }
  table { flex: 1; height: 0; }
  tbody { height: 100%; }
  tbody tr { height: calc(100% / var(--week-count, 5)); }
  td.today { background: #fff !important; }
  td.today .day-num { color: #111 !important; }
}

/* ══════════════════════════════════════
   반응형 — 태블릿 (≤768px)
══════════════════════════════════════ */
@media screen and (max-width: 768px) {

  /* 툴바 */
  .toolbar { padding: 8px 12px; }
  .sel-year { min-width: 66px; font-size: 0.88rem; padding: 5px 8px; }
  .sel-month { min-width: 50px; font-size: 0.88rem; padding: 5px 8px; }
  .seg-btn { font-size: 0.8rem; padding: 5px 12px; }
  .btn-print { padding: 6px 14px; font-size: 0.84rem; }

  /* 시간표 상단 */
  .tt-top-area { padding: 14px 20px 0; }
  .tt-month-title { font-size: 1.3rem; margin-bottom: 6px; }
  .tt-underline { margin-bottom: 12px; }
  .btn-export-gcal { padding: 7px 12px; font-size: 0.8rem; }

  /* 그리드: 가로 스크롤 허용 */
  .tt-grid-area {
    padding: 0 10px 16px;
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* flex 해제 — 고정 행 높이 방식으로 전환 */
    display: block;
  }

  /* 테이블: 최소 너비 고정, 높이는 행 고정 */
  #tt-table {
    flex: none;
    height: auto;
    min-width: 480px;
    min-height: unset;
  }
  #tt-table tbody { height: auto; }
  #tt-table tbody tr { height: 52px; }

  /* 헤더 */
  #tt-table thead th {
    padding: 8px 3px;
    font-size: 0.76rem;
    letter-spacing: 0;
  }
  #tt-table thead th.tt-time-col { width: 76px; }

  /* 시간 컬럼 */
  #tt-table td.tt-time-col { font-size: 0.68rem; }

  /* 카드 */
  .tt-class-card { padding: 2px 4px 2px 6px; gap: 4px; }
  .tt-card-name { font-size: 0.76rem; }
  .tt-card-instr { font-size: 0.58rem; padding: 1px 3px; }

  /* 월 이동 버튼: 터치에서도 보이게, 작게 */
  .side-nav-btn { opacity: 0.3; width: 26px; height: 72px; font-size: 1.5rem; }

  /* ── 캘린더(월간): 구글 캘린더 위젯 스타일 ── */
  .page {
    height: auto;
    min-height: calc(100vh - 52px);
    padding: 10px 8px 8px;
  }
  .cal-header { padding-bottom: 4px; border-bottom-width: 1.5px; }
  .month-title { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.5px; }
  .print-date { display: none; }
  #cal-table { flex: none; height: auto; }
  #cal-table tbody tr { height: 92px; }
  #cal-table thead th {
    font-size: 0.72rem;
    text-align: center;
    padding: 5px 0 4px;
  }
  td.day-cell { padding: 3px 2px 4px; }
  td.day-cell .day-num {
    font-size: 0.75rem;
    font-weight: 700;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    margin: 0 auto 2px;
  }
  td.today .day-num { background: #1a73e8; color: #fff; border-radius: 50%; }
  .holiday { font-size: 0.58rem; text-align: center; margin-bottom: 2px; }
  .events { gap: 2px; }
  .event {
    display: block;
    font-size: 0.62rem;
    font-weight: 600;
    line-height: 1.5;
    padding: 1px 4px;
    border-left: none;
    border-radius: 4px;
    background: var(--ev-bg, #f0f2f5);
    color: var(--ev-fg, #333);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .event-time { display: none; }
  .cal-event {
    font-size: 0.6rem;
    padding: 1px 4px;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* 일정 3개까지만 표시, 나머지는 +N */
  .events > :nth-child(n+4):not(.event-more) { display: none; }
  .event-more {
    display: block;
    font-size: 0.6rem;
    font-weight: 700;
    color: #888;
    padding-left: 4px;
  }
}

/* ══════════════════════════════════════
   반응형 — 스마트폰 (≤480px)
══════════════════════════════════════ */
@media screen and (max-width: 480px) {

  /* 툴바: 2줄 처리 */
  .toolbar {
    flex-wrap: wrap;
    height: auto;
    padding: 7px 10px;
    gap: 6px;
  }
  .toolbar-center {
    /* absolute 해제 → 일반 흐름으로 */
    position: static;
    transform: none;
    order: 3;
    width: 100%;
    justify-content: center;
    padding: 3px;
  }
  .toolbar-left { order: 1; }
  .toolbar-right { order: 2; }
  .seg-btn { font-size: 0.76rem; padding: 4px 10px; }
  /* 이모지 숨기고 텍스트만 */
  #seg-input::before  { content: "입력"; }
  #seg-input          { font-size: 0; }
  #seg-input::before  { font-size: 0.76rem; }
  #seg-tt::before     { content: "시간표"; }
  #seg-tt             { font-size: 0; }
  #seg-tt::before     { font-size: 0.76rem; }
  #seg-cal::before    { content: "캘린더"; }
  #seg-cal            { font-size: 0; }
  #seg-cal::before    { font-size: 0.76rem; }
  .btn-print          { font-size: 0; padding: 6px 10px; }
  .btn-print::before  { content: "🖨"; font-size: 1rem; }

  /* 페이지 높이: 툴바 2줄(약 96px) 반영 */
  .tt-page { height: calc(100vh - 96px); }
  .page    { height: calc(100vh - 96px); }

  /* 시간표 상단 */
  .tt-top-area { padding: 10px 12px 0; }
  .tt-month-title { font-size: 1.1rem; margin-bottom: 4px; }
  .tt-underline { margin-bottom: 10px; height: 2px; }

  /* 테이블: 가로 스크롤 없이 한 화면에 (월~토 전부 표시) */
  #tt-table { min-width: 0; width: 100%; }
  #tt-table tbody tr { height: 46px; }
  #tt-table thead th { padding: 7px 1px; font-size: 0.7rem; }
  #tt-table thead th.tt-time-col { width: 42px; }
  #tt-table td { padding: 4px 2px; }
  #tt-table td.tt-time-col { font-size: 0.62rem; }

  /* 시간 라벨: 시작 시간만 표시 */
  .tt-time-full { display: none; }
  .tt-time-short { display: inline; }

  /* 강사 뱃지 숨김 (컬러 바로 구분) */
  .tt-card-instr { display: none; }
  .tt-class-card { padding: 2px 2px 2px 4px; border-left-width: 3px !important; }
  .tt-card-name { font-size: 0.68rem; }

  /* 캘린더(월간) 폰 보정 */
  .page { min-height: calc(100vh - 96px); padding: 8px 4px 6px; }
  .month-title { font-size: 1.25rem; }
  #cal-table tbody tr { height: 84px; }
  .event { font-size: 0.58rem; }
  .cal-event { font-size: 0.56rem; }

  /* 날짜 팝업: 화면 안에 맞춤 */
  .day-popup { width: min(320px, calc(100vw - 32px)); }
}
