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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f4f5f7;
  color: #1f2933;
  min-height: 100vh;
}

.hidden { display: none !important; }

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
}

/* Login */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.login-card {
  background: #fff;
  padding: 40px 32px;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.1);
  width: 100%;
  max-width: 380px;
}
.login-logo { font-size: 52px; text-align: center; margin-bottom: 8px; }
.login-card h1 {
  font-size: 24px;
  margin-bottom: 8px;
  text-align: center;
}
.login-card p.sub {
  text-align: center;
  color: #6b7280;
  margin-bottom: 24px;
}
.login-field { margin-bottom: 14px; }
.login-field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 15px;
}
.login-btn { width: 100%; padding: 12px; font-size: 15px; }
.login-error {
  background: #fdecea;
  color: #c0392b;
  border: 1px solid #f5c6cb;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 13px;
  text-align: center;
}
.login-note {
  margin-top: 18px;
  text-align: center;
  color: #9ca3af;
  font-size: 12px;
  line-height: 1.6;
}
.logout-btn {
  position: absolute;
  right: 20px;
  padding: 6px 14px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  top: 50%;
  transform: translateY(-50%);
}
.topbar-btns { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); display: flex; gap: 8px; }
.topbar-btns .logout-btn { position: static; transform: none; }

.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 1000;
  padding: 20px;
}
.login-close {
  width: 100%;
  margin-top: 10px;
  border: 1px solid #d1d5db;
  color: #6b7280;
}
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 14px;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
}
.form-group textarea { resize: vertical; min-height: 80px; }
.btn {
  display: inline-block;
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s;
}
.btn-primary { background: #1a73e8; color: #fff; }
.btn-primary:hover { background: #1765cc; }
.btn-danger { background: #d93025; color: #fff; }
.btn-danger:hover { background: #b3261e; }
.btn-outline { background: transparent; color: #1a73e8; border: 1px solid #1a73e8; }
.btn-outline:hover { background: #eaf2ff; }
.btn-block { width: 100%; }

.error { color: #d93025; font-size: 13px; margin-top: 8px; text-align: center; }

/* Header / nav */
header.topbar {
  background: #1f2933;
  color: #fff;
  padding: 14px 0;
}
.topbar-inner {
  position: relative;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.topbar h2 { font-size: 26px; text-align: center; }
.topbar .user-area { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.topbar .badge {
  background: #1a73e8;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
}
.topbar .logout {
  background: transparent;
  color: #fca5a5;
  border: 1px solid #fca5a5;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}
.tab {
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  background: #e5e7eb;
  font-weight: 600;
  border: none;
}
.tab.active { background: #1a73e8; color: #fff; }

/* Cards */
.card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  margin-bottom: 20px;
}
.card h3 { margin-bottom: 16px; font-size: 18px; }

.event-list { list-style: none; }
.event-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid #f0f0f0;
}
.event-item:last-child { border-bottom: none; }
.event-date {
  min-width: 90px;
  text-align: center;
  background: #eaf2ff;
  color: #1a73e8;
  border-radius: 10px;
  padding: 10px 8px;
  font-weight: 700;
}
.event-date .day { font-size: 22px; display: block; }
.event-date .month { font-size: 12px; }
.event-info { flex: 1; margin: 0 16px; }
.event-info .ev-title { font-weight: 700; font-size: 16px; }
.event-info .ev-meta { color: #6b7280; font-size: 13px; margin-top: 4px; }
.event-actions { display: flex; gap: 8px; }

/* Announcements */
.ann-item {
  padding: 16px 0;
  border-bottom: 1px solid #f0f0f0;
}
.ann-item:last-child { border-bottom: none; }
.ann-item .ann-date { color: #6b7280; font-size: 12px; }
.ann-item h4 { margin: 4px 0; }
.ann-item p { color: #374151; font-size: 14px; line-height: 1.5; }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal h3 { margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* Welcome / student */
.welcome-strip {
  background: #1a73e8;
  color: #fff;
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 20px;
}
.welcome-strip p { opacity: 0.9; margin-top: 4px; }

@media (max-width: 640px) {
  .topbar h2 { font-size: 20px; }
  .logout-btn { right: 12px; padding: 5px 10px; font-size: 12px; }
  .container { padding: 12px; }
  .event-item { flex-direction: column; align-items: flex-start; gap: 10px; }
  .event-actions { width: 100%; }
  .calendar-grid { gap: 3px; }
  .cal-day { min-height: 78px; padding: 3px; font-size: 10px; }
  .cal-weekday { font-size: 10px; padding: 3px 0; }
  .cal-num { margin-bottom: 2px; font-size: 10px; }
  .cal-section { margin-top: 1px; }
  .cal-section-label { font-size: 11px; margin-bottom: 2px; padding: 1px 2px; }
  .cal-section .cal-event { font-size: 10px; margin-bottom: 1px; padding: 1px 2px; line-height: 1.2; }
  .calendar-head h3 { font-size: 15px; }
  .calendar-head .btn { padding: 6px 10px; font-size: 12px; }
  .detail-badge { min-width: 90px; padding: 6px 8px; }
  .detail-emoji { font-size: 18px; }
  .detail-time { font-size: 10px; }
  .stat-pill { font-size: 11px; padding: 4px 8px; }
}

/* Calendar */
.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.calendar-head h3 { margin: 0; font-size: 18px; }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.cal-weekday {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #6b7280;
  padding: 6px 0;
}
.cal-day {
  min-height: 210px;
  background: #f9fafb;
  border: 1px solid #eef0f3;
  border-radius: 8px;
  padding: 6px;
  font-size: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.cal-day.empty { background: transparent; border-color: transparent; }
.cal-day.today { border-color: #1a73e8; box-shadow: 0 0 0 1px #1a73e8; }
.cal-day .cal-num { font-weight: 700; margin-bottom: 4px; }
.cal-day .cal-num.sunday { color: #d93025; }
.cal-day .cal-num.saturday { color: #1a73e8; }
.cal-event {
  background: #1a73e8;
  color: #fff;
  border-radius: 4px;
  padding: 2px 5px;
  margin-bottom: 2px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.cal-event.department { background: #188038; }
.cal-day .cal-more { color: #1a73e8; font-size: 11px; cursor: pointer; }

/* 셀 내 점심/방과후 2분할 */
.cal-section { margin-top: 3px; }
.cal-section.lunch { border-bottom: 1px solid #94a3b8; }
.cal-section.empty { display: none; }
.cal-section-label {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 4px;
  padding: 2px 4px;
}
.cal-section.lunch .cal-section-label { color: #d97706; }
.cal-section.after .cal-section-label { color: #4338ca; }
.cal-section.morning .cal-section-label { color: #00b894; }
.cal-section .cal-event { margin-bottom: 2px; font-size: 11px; }

.col-hint {
  background: #f4f5f7;
  border: 1px solid #eef0f3;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
  color: #374151;
}

#dayDetails { margin-top: 16px; }
#dayDetails .day-detail-title { font-weight: 700; margin-bottom: 8px; }
/* 상세 일정 목록 - 악기/시간대별 */
.detail-item {
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 8px;
  border-radius: 8px;
  border-bottom: none;
}
.detail-badge {
  min-width: 108px;
  border-radius: 8px;
  color: #fff;
  padding: 8px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.detail-emoji { font-size: 22px; line-height: 1; }
.detail-time { font-size: 11px; opacity: 0.95; }
.inst-emoji { font-size: 16px; margin-right: 2px; }

/* 통계 배지 */
.stat-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 14px;
}
.stat-pill {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 12px;
  color: #475569;
  white-space: nowrap;
}
.stat-pill strong { color: #1a73e8; }

/* 중요 공지 (상단, 하늘색 파스텔) */
#pinnedAnnounce {
  background: #e0f2fe;
  color: #0c4a6e;
  text-align: center;
}
#pinnedAnnounce h4, #pinnedAnnounce p { color: #0c4a6e; }
#pinnedAnnounce .pinned-date { opacity: 0.7; }
.pinned-item h4 { margin: 6px 0 4px; font-size: 16px; }
.pinned-item p { opacity: 0.95; font-size: 14px; line-height: 1.5; }
.pinned-item + .pinned-item { margin-top: 12px; padding-top: 12px; border-top: 1px solid #bae0fc; }
.pinned-head { display: flex; justify-content: center; align-items: center; gap: 8px; }
.pin-badge {
  background: #7cc0f0;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}
.pinned-date { font-size: 12px; opacity: 0.85; }

/* 공지 목록에서 핀 고정된 항목 */
.ann-item.pinned { background: #eaf2ff; border-left: 4px solid #1a73e8; border-radius: 6px; padding: 12px 14px; }

/* 시간 탭 (일정 추가/수정 모달) */
.time-tabs, .inst-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.time-tab, .inst-tab {
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}
.time-tab:hover, .inst-tab:hover { border-color: #1a73e8; color: #1a73e8; }
.time-tab.active, .inst-tab.active {
  background: #1a73e8;
  color: #fff;
  border-color: #1a73e8;
  font-weight: 600;
}

/* 모바일 캘린더 압축 (파일 끝에 두어 데스크톱 규칙을 덮음) */
@media (max-width: 640px) {
  .calendar-head h3 { font-size: 16px; }
  .calendar-head .btn { padding: 6px 10px; font-size: 12px; }
  .calendar-grid { gap: 3px; }
  .cal-day { min-height: 96px; padding: 3px; font-size: 10px; }
  .cal-weekday { font-size: 10px; padding: 3px 0; }
  .cal-num { margin-bottom: 2px; font-size: 10px; }
  .cal-section { margin-top: 1px; }
  .cal-section-label { font-size: 11px; margin-bottom: 2px; padding: 1px 2px; }
  .cal-section .cal-event { font-size: 10px; margin-bottom: 1px; padding: 1px 2px; line-height: 1.2; }
  .cal-event { padding: 1px 2px; }
}
.optional { font-size: 12px; color: #9ca3af; font-weight: 400; }
