:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e3e5e9;
  --text: #1f2329;
  --text-muted: #6b7280;
  --primary: #4361ee;
  --primary-hover: #3651d4;
  --today-bg: #eef2ff;
  --sun: #e0483e;
  --sat: #3163d4;
  --chip-bg: #eef2ff;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.app-header h1 {
  font-size: 22px;
  margin: 0;
}

.month-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.month-label {
  font-size: 18px;
  font-weight: 600;
  min-width: 130px;
  text-align: center;
}

.nav-btn,
.today-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 16px;
  cursor: pointer;
  color: var(--text);
}

.nav-btn:hover,
.today-btn:hover {
  background: var(--today-bg);
}

.today-btn {
  font-size: 13px;
  padding: 6px 10px;
}

.weekday-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 6px;
}

.weekday {
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 0;
}

.weekday.sun {
  color: var(--sun);
}

.weekday.sat {
  color: var(--sat);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: minmax(100px, auto);
  gap: 6px;
}

.day-cell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 100px;
  transition: box-shadow 0.15s ease;
}

.day-cell:hover {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.day-cell.other-month {
  opacity: 0.4;
}

.day-cell.today {
  background: var(--today-bg);
  border-color: var(--primary);
}

.day-number {
  font-size: 13px;
  font-weight: 600;
}

.day-number.sun {
  color: var(--sun);
}

.day-number.sat {
  color: var(--sat);
}

.day-schedules {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}

.schedule-chip {
  background: var(--chip-bg);
  color: var(--primary);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.more-chip {
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 6px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: var(--surface);
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px 24px 24px;
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.modal-header h2 {
  font-size: 18px;
  margin: 0;
}

.close-btn {
  border: none;
  background: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}

.schedule-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.schedule-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--bg);
  border-radius: 8px;
  padding: 10px 12px;
}

.schedule-item .item-time {
  font-weight: 700;
  color: var(--primary);
  font-size: 13px;
  min-width: 48px;
}

.schedule-item .item-body {
  flex: 1;
}

.schedule-item .item-content {
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

.schedule-item .item-author {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.schedule-item .delete-btn {
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
}

.schedule-item .delete-btn:hover {
  color: var(--sun);
}

.empty-note {
  font-size: 13px;
  color: var(--text-muted);
  padding: 4px 0 8px;
}

.schedule-form h3 {
  font-size: 14px;
  margin: 12px 0 10px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.form-row label {
  font-size: 13px;
  font-weight: 600;
}

.form-row input,
.form-row textarea {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}

.form-row input:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.submit-btn {
  width: 100%;
  padding: 10px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
}

.submit-btn:hover {
  background: var(--primary-hover);
}

@media (max-width: 640px) {
  .day-cell {
    min-height: 70px;
    padding: 5px;
  }
  .schedule-chip,
  .more-chip {
    font-size: 10px;
  }
}
