:root {
  --bg: #0b0c0f;
  --card: #111318;
  --muted: #aab2c0;
  --text: #e7ecf3;
  --accent: #7c9cff;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f8fb;
    --card: #ffffff;
    --muted: #64748b;
    --text: #0f172a;
    --accent: #4f46e5;
  }
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Noto Sans, Ubuntu, Cantarell, Helvetica Neue, Arial, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  color: var(--text);
  background: var(--bg);
}

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

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

.title {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.title h1 {
  margin: 0;
  font-size: clamp(22px, 4vw, 34px);
}

.subtitle {
  color: var(--muted);
  font-size: 14px;
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

button, select, input[type="datetime-local"], input[type="text"], input[type="number"] {
  background: var(--card);
  color: var(--text);
  border: 1px solid #ffffff1a;
  padding: 8px 10px;
  border-radius: 10px;
}

button.primary { background: var(--accent); border-color: transparent; color: white; }

.grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
}

@media (max-width: 980px) {
  .grid { grid-template-columns: 1fr; }
}

.card {
  background: var(--card);
  border: 1px solid #ffffff1a;
  border-radius: 16px;
  padding: 12px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat {
  background: #ffffff08;
  border: 1px solid #ffffff0f;
  padding: 10px;
  border-radius: 12px;
}

.stat .label { color: var(--muted); font-size: 12px; }
.stat .value { font-size: 18px; font-weight: 600; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  z-index: 9999;
  background: rgb(2 6 23 / 72%);
  backdrop-filter: blur(6px) saturate(120%);
  -webkit-backdrop-filter: blur(6px) saturate(120%);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal { background: var(--card); border: 1px solid #ffffff1a; border-radius: 16px; width: 100%; max-width: 520px; box-shadow: 0 10px 40px #00000066; }
.modal:focus { outline: none; }
.modal header { display:flex; align-items:center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid #ffffff14; }
.modal .body { padding: 16px; display: grid; gap: 12px; }
.modal .row { display: grid; gap: 6px; }
.modal footer { padding: 12px 16px; display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid #ffffff14; }

.chip { display:inline-flex; align-items:center; gap:6px; background:#ffffff0d; border:1px solid #ffffff1a; padding:6px 10px; border-radius:999px; font-size:12px; }

/* FullCalendar overrides */
.fc { --fc-page-bg-color: transparent; }
.fc .fc-toolbar-title { font-size: 16px; }
.fc .fc-col-header { background: var(--card); border-bottom: 1px solid #ffffff14; box-shadow: 0 6px 10px #0000001a; z-index: 3; }
.fc .fc-col-header-cell { background: var(--card); }
.fc .fc-col-header-cell .fc-scrollgrid-sync-inner { background: var(--card); }
.fc .fc-timegrid-header { background: var(--card); }
.fc .fc-scrollgrid-section-sticky > * { background: var(--card) !important; }
.fc .fc-scrollgrid { background: transparent; }
.fc .fc-col-header-cell-cushion { padding: 8px 4px; color: var(--text); }
.fc .fc-col-header-cell.fc-day-today { box-shadow: inset 0 -3px 0 var(--accent); }
.fc .fc-scrollgrid { border-color: #ffffff1a; }
.fc .fc-timegrid-slot { height: 36px; }
.fc .fc-event { border-radius: 10px; border: none; padding: 2px 6px; }
.fc .fc-timegrid-now-indicator-arrow { border-color: var(--accent); }
.fc .fc-timegrid-now-indicator-line { border-color: var(--accent); }

/* Point events (수면 제외 이벤트들) - 짧은 이벤트로 표시 */
.fc .fc-event.point-event {
  border-radius: 8px;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  min-height: 24px;
  position: relative;
}

/* 짧은 이벤트에 시간 표시 추가 */
.fc .fc-event.point-event .fc-event-time {
  font-size: 11px;
  opacity: 0.9;
  display: none; /* 기본적으로 숨김 */
}

/* 아이콘 강조 */
.fc .fc-event.point-event .fc-event-title {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* 포인트 이벤트에 좌측 바 추가 (시각적 구분) */
.fc .fc-event.point-event::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: currentColor;
  opacity: 0.5;
  border-radius: 8px 0 0 8px;
}

/* 호버 효과 */
.fc .fc-event.point-event:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0,0,0,0.2);
  z-index: 10;
}

/* 수면 이벤트는 기존 스타일 유지 */
.fc .fc-event:not(.point-event) {
  opacity: 0.85;
}

/* 리사이즈 핸들 숨기기 (수면 제외) */
.fc .fc-event.point-event .fc-event-resizer {
  display: none;
}

/* 일별 요약 이벤트 스타일 */
.fc .fc-event.daily-summary {
  background: linear-gradient(135deg, rgba(124, 156, 255, 0.08), rgba(124, 156, 255, 0.04)) !important;
  border: 1px solid rgba(124, 156, 255, 0.15) !important;
  color: var(--text) !important;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  cursor: default;
  pointer-events: none;
  border-radius: 6px;
  letter-spacing: -0.2px;
}

.fc .fc-event.daily-summary .fc-event-title {
  opacity: 0.85;
}

.fc .fc-event.daily-summary:hover {
  transform: none;
  box-shadow: none;
}

/* allDay 슬롯 스타일 */
.fc .fc-daygrid-day-events {
  min-height: 24px;
}

.fc .fc-timegrid-divider {
  padding: 0;
}

.fc .fc-timegrid-axis-cushion {
  color: var(--muted);
  font-size: 12px;
}

/* 뉴진스 테마 - Y2K 미니멀 감성 */
body.cute-theme {
  --bg: #fafafa;
  --card: #ffffff;
  --muted: #6b6b6b;
  --text: #1a1a1a;
  --accent: #7c9cff;
  --border: #e8e8e8;
  --pink: #ffb3ba;
  --blue: #bae1ff;
  --yellow: #ffffba;
  --mint: #baffc9;
  --purple: #e0bbff;
  font-family: "Pretendard", "Noto Sans KR", ui-sans-serif, system-ui, sans-serif;
  background: var(--bg);
}

body.cute-theme h1 {
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.02em;
}

body.cute-theme .subtitle {
  color: var(--muted);
  font-weight: 500;
}

body.cute-theme .card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.2s ease;
}

body.cute-theme .card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

body.cute-theme button {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  font-weight: 500;
  color: var(--text);
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

body.cute-theme button:hover {
  background: #f8f8f8;
  border-color: var(--accent);
  box-shadow: 0 2px 6px rgba(124, 156, 255, 0.15);
}

body.cute-theme button.primary {
  background: var(--accent);
  color: white;
  border: none;
  font-weight: 600;
}

body.cute-theme button.primary:hover {
  background: #6b8ff0;
}

body.cute-theme select, 
body.cute-theme input {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  color: var(--text);
  font-weight: 400;
}

body.cute-theme select:focus,
body.cute-theme input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 156, 255, 0.1);
}

body.cute-theme .stat {
  background: #f8f8f8;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  transition: background 0.2s;
}

body.cute-theme .stat:hover {
  background: #f0f0f0;
}

body.cute-theme .stat .label {
  color: var(--muted);
  font-weight: 500;
}

body.cute-theme .stat .value {
  color: var(--text);
  font-weight: 700;
}

body.cute-theme .chip {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  font-weight: 500;
  color: var(--text);
  transition: all 0.2s;
  border-radius: 20px;
}

body.cute-theme .chip:hover {
  background: #f8f8f8;
  border-color: var(--accent);
}

/* 뉴진스 테마 - 캘린더 스타일 */
body.cute-theme .fc {
  --fc-border-color: #e8e8e8;
  --fc-event-border-radius: 8px;
  --fc-page-bg-color: transparent;
}

body.cute-theme .fc .fc-col-header {
  background: #ffffff;
  border-bottom: 1px solid #e8e8e8;
}

body.cute-theme .fc .fc-col-header-cell {
  background: #ffffff;
  color: var(--text);
  font-weight: 600;
}

body.cute-theme .fc .fc-col-header-cell.fc-day-today {
  box-shadow: inset 0 -2px 0 var(--accent);
}

body.cute-theme .fc .fc-scrollgrid {
  border-color: #e8e8e8;
}

body.cute-theme .fc .fc-event {
  border-radius: 8px;
  font-weight: 500;
  border: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.2s;
}

body.cute-theme .fc .fc-event:hover {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

body.cute-theme .fc .fc-event.daily-summary {
  background: #f5f5f5 !important;
  border: 1px solid #e0e0e0 !important;
  color: var(--muted) !important;
  font-weight: 500;
  font-size: 11px;
  box-shadow: none;
}

body.cute-theme .fc .fc-timegrid-now-indicator-arrow,
body.cute-theme .fc .fc-timegrid-now-indicator-line {
  border-color: var(--accent);
}

body.cute-theme .fc .fc-timegrid-axis-cushion {
  color: var(--muted);
}

/* 뉴진스 테마 - 모달 스타일 */
body.cute-theme .modal-backdrop {
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
}

body.cute-theme .modal {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

body.cute-theme .modal header {
  background: #fafafa;
  border-bottom: 1px solid #e8e8e8;
  color: var(--text);
  font-weight: 600;
}

body.cute-theme .modal footer {
  border-top: 1px solid #e8e8e8;
}

body.cute-theme .modal label {
  color: var(--muted);
  font-weight: 500;
}

/* 뉴진스 테마 - 스크롤바 */
body.cute-theme ::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

body.cute-theme ::-webkit-scrollbar-track {
  background: #f5f5f5;
  border-radius: 4px;
}

body.cute-theme ::-webkit-scrollbar-thumb {
  background: #d0d0d0;
  border-radius: 4px;
}

body.cute-theme ::-webkit-scrollbar-thumb:hover {
  background: #b0b0b0;
}

/* 뉴진스 테마 - 카테고리별 톤다운 파스텔 색상 (모든 형식 대응) */
body.cute-theme .fc .fc-event[style*="E91E63"],
body.cute-theme .fc .fc-event[style*="rgb(233, 30, 99)"],
body.cute-theme .fc .fc-event.point-event[style*="E91E63"],
body.cute-theme .fc .fc-event.point-event[style*="rgb(233, 30, 99)"] {
  background: #ffe8eb !important;
  color: #c71e54 !important;
  border: 1px solid #ffc4cc !important;
  font-weight: 600;
  text-shadow: none !important;
}

body.cute-theme .fc .fc-event[style*="4CAF50"],
body.cute-theme .fc .fc-event[style*="rgb(76, 175, 80)"],
body.cute-theme .fc .fc-event.point-event[style*="4CAF50"],
body.cute-theme .fc .fc-event.point-event[style*="rgb(76, 175, 80)"] {
  background: #e8f5e9 !important;
  color: #2e7d32 !important;
  border: 1px solid #c8e6c9 !important;
  font-weight: 600;
  text-shadow: none !important;
}

body.cute-theme .fc .fc-event[style*="9C27B0"],
body.cute-theme .fc .fc-event[style*="rgb(156, 39, 176)"],
body.cute-theme .fc .fc-event.point-event[style*="9C27B0"],
body.cute-theme .fc .fc-event.point-event[style*="rgb(156, 39, 176)"] {
  background: #f8e8ff !important;
  color: #7b1fa2 !important;
  border: 1px solid #e1bee7 !important;
  font-weight: 600;
  text-shadow: none !important;
}

body.cute-theme .fc .fc-event[style*="2196F3"],
body.cute-theme .fc .fc-event[style*="rgb(33, 150, 243)"],
body.cute-theme .fc .fc-event.point-event[style*="2196F3"],
body.cute-theme .fc .fc-event.point-event[style*="rgb(33, 150, 243)"] {
  background: #e8f4ff !important;
  color: #1565c0 !important;
  border: 1px solid #bbdefb !important;
  font-weight: 600;
  text-shadow: none !important;
}

body.cute-theme .fc .fc-event[style*="FF9800"],
body.cute-theme .fc .fc-event[style*="rgb(255, 152, 0)"],
body.cute-theme .fc .fc-event.point-event[style*="FF9800"],
body.cute-theme .fc .fc-event.point-event[style*="rgb(255, 152, 0)"] {
  background: #fff8e1 !important;
  color: #e65100 !important;
  border: 1px solid #ffe0b2 !important;
  font-weight: 600;
  text-shadow: none !important;
}

/* 뉴진스 테마 - 이벤트 제목 텍스트 가독성 개선 */
body.cute-theme .fc .fc-event .fc-event-title {
  font-weight: 600;
  letter-spacing: -0.3px;
  font-size: 12px;
  color: inherit !important;
}

/* 뉴진스 테마 - 포인트 이벤트 좌측 바 제거 (보더로 충분) */
body.cute-theme .fc .fc-event.point-event::before {
  display: none;
}

/* 뉴진스 테마 - 수면 이벤트 (긴 시간 블록) 투명도 조정 */
body.cute-theme .fc .fc-event:not(.point-event) {
  opacity: 1 !important;
}

/* 뉴진스 테마 - 호버 효과 재정의 */
body.cute-theme .fc .fc-event:hover {
  transform: none !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12) !important;
}

body.cute-theme .fc .fc-event,
body.cute-theme .fc .fc-event .fc-event-title-container,
body.cute-theme .fc .fc-event .fc-event-title,
body.cute-theme .fc .fc-event .fc-event-time {
  color: #333333 !important;
}

/* 뉴진스 테마 - 빠른 추가 버튼 아이콘 색상 */
body.cute-theme [data-quick="MOTHERS_MILK"] { border-left: 3px solid var(--pink); }
body.cute-theme [data-quick="FORMULA"] { border-left: 3px solid var(--mint); }
body.cute-theme [data-quick="BABY_FOOD"] { border-left: 3px solid var(--purple); }
body.cute-theme [data-quick="SLEEP"] { border-left: 3px solid var(--blue); }
body.cute-theme [data-quick="NAPPY"] { border-left: 3px solid var(--yellow); }