:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --line: #ecedf0;
  --ink: #1f2328;
  --muted: #9aa0a8;
  --sun: #e5484d;
  --sat: #3b82f6;
  --today: #4c6ef5;        /* 오늘 강조 (인디고) */
  --normal: #2f9e44;       /* 일반 일정 (초록) */
  --check: #4dabf7;        /* 확인용 (연한 파랑) */
  --holiday: #f06595;      /* 대한민국 공휴일 (분홍) */
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Malgun Gothic", "Noto Sans KR", sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

/* ── 상단바 ─────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  padding: 11px 16px;
  padding-top: max(11px, env(safe-area-inset-top));
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.topbar-left { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.brand { font-weight: 800; font-size: 17px; letter-spacing: -.02em; }
.range { color: var(--muted); font-size: 13px; white-space: nowrap; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.legend { display: flex; gap: 10px; flex-wrap: wrap; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: #5b6169; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

.today-btn {
  font-size: 13px; font-weight: 600; text-decoration: none;
  color: #fff; background: var(--today);
  padding: 6px 13px; border-radius: 999px;
  box-shadow: 0 1px 2px rgba(76, 110, 245, .35);
}
.today-btn:active { transform: translateY(1px); }
.user { display: flex; align-items: center; gap: 8px; }
.user img { width: 27px; height: 27px; border-radius: 50%; border: 1px solid var(--line); }
.logout { font-size: 12px; color: var(--muted); text-decoration: none; }

.notice {
  margin: 12px 16px 0;
  padding: 12px 14px;
  background: #fff9db;
  border: 1px solid #ffe066;
  border-radius: 12px;
  font-size: 13px;
}
.notice code, .login-error code { background: rgba(0,0,0,.06); padding: 1px 5px; border-radius: 4px; }

/* ── 요일 헤더 ──────────────────────── */
.weekday-bar {
  position: sticky;
  top: 53px;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.wd { text-align: center; padding: 8px 0; font-size: 12px; font-weight: 700; color: #6b7178; }
.wd.sun { color: var(--sun); }
.wd.sat { color: var(--sat); }

/* ── 달력 본문 ──────────────────────── */
.calendar { padding: 10px; max-width: 1100px; margin: 0 auto; }
.week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 7px;
  margin-bottom: 7px;
}
.day {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 104px;
  padding: 6px 6px 7px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.day.out { background: #fbfbfc; box-shadow: none; border-style: dashed; }
.day.out .dnum { color: #c4c8ce; }
.day.today { border-color: var(--today); box-shadow: 0 0 0 2px var(--today) inset, var(--shadow); }

.day-head { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; min-height: 20px; }
.dnum { font-size: 13px; font-weight: 700; color: #3a3f46; line-height: 20px; }
.day.sun .dnum { color: var(--sun); }
.day.sat .dnum { color: var(--sat); }
.day.holiday .dnum { color: var(--holiday); }
.day.today .dnum {
  background: var(--today); color: #fff;
  border-radius: 999px; padding: 0 7px; min-width: 20px; text-align: center;
}
.month-badge {
  font-size: 11px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, #495057, #343a40);
  padding: 1px 7px; border-radius: 7px; letter-spacing: -.01em;
}

.events { display: flex; flex-direction: column; gap: 3px; }
.ev {
  --c: var(--normal);
  font-size: 11.5px;
  line-height: 1.28;
  border-radius: 6px;
  padding: 2px 6px;
  background: color-mix(in srgb, var(--c) 13%, white);
  color: color-mix(in srgb, var(--c) 62%, #1f2328);
  border-left: 3px solid var(--c);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  word-break: break-word;
}
/* 일반 일정: 초록, 또렷하게 */
.ev.cat-normal { --c: var(--normal); font-weight: 600; }
/* 공휴일: 분홍 */
.ev.cat-holiday { --c: var(--holiday); font-weight: 600; }
/* 확인용: 연한 파랑, 존재만 확인하면 되는 가벼운 항목 → 점선 + 옅게 */
.ev.cat-check {
  --c: var(--check);
  font-weight: 500;
  border-left-style: dashed;
  background: color-mix(in srgb, var(--c) 10%, white);
  color: color-mix(in srgb, var(--c) 55%, #495057);
}

.ev.allday { background: var(--c); color: #fff; border-left: none; }
.ev.cat-check.allday { background: color-mix(in srgb, var(--c) 78%, white); color: #fff; }
.ev .t { font-weight: 700; margin-right: 3px; opacity: .78; font-size: 10.5px; }

/* 여러 날 걸친 이벤트: 좌우로 이어지는 느낌 */
.ev.multi.cont { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -7px; padding-left: 9px; }
.ev.multi.tobe { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: -7px; padding-right: 9px; }

/* ── 로그인 ─────────────────────────── */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(160deg, #e7f5ff, #ebfbee); }
.login-card {
  background: var(--card);
  border-radius: 20px;
  padding: 38px 30px;
  width: min(360px, 90vw);
  text-align: center;
  box-shadow: 0 12px 40px rgba(16, 24, 40, .12);
}
.login-emoji { font-size: 34px; }
.login-card h1 { margin: 8px 0 2px; font-size: 22px; letter-spacing: -.02em; }
.login-sub { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.google-btn {
  display: inline-flex; align-items: center; gap: 10px;
  width: 100%; justify-content: center;
  padding: 12px 0; border-radius: 12px;
  background: #fff; border: 1px solid #dadce0;
  color: #3c4043; font-weight: 600; font-size: 15px; text-decoration: none;
}
.google-btn:hover { background: #f8f9fa; }
.login-hint { color: var(--muted); font-size: 12px; margin: 14px 0 0; }
.login-error {
  background: #fff5f5; border: 1px solid #ffc9c9; color: #c92a2a;
  padding: 10px 12px; border-radius: 12px; font-size: 13px; margin-bottom: 16px;
}

/* ── 모바일 ─────────────────────────── */
@media (max-width: 640px) {
  .topbar { padding: 9px 12px; gap: 6px 10px; }
  .brand { font-size: 16px; }
  .range { display: none; }
  .legend { gap: 8px; order: 3; width: 100%; }
  .legend-item { font-size: 11px; }
  .today-btn { padding: 5px 11px; font-size: 12px; }

  .weekday-bar { top: 44px; }
  .wd { padding: 6px 0; font-size: 11px; }

  .calendar { padding: 5px; }
  .week { gap: 4px; margin-bottom: 4px; }
  .day { min-height: 78px; border-radius: 9px; padding: 4px; }
  .day-head { margin-bottom: 2px; min-height: 18px; }
  .dnum { font-size: 12px; line-height: 18px; }
  .day.today .dnum { padding: 0 6px; min-width: 18px; }
  .month-badge { font-size: 10px; padding: 1px 5px; }
  .events { gap: 2px; }
  .ev { font-size: 10px; padding: 1px 4px; border-radius: 5px; }
  .ev .t { font-size: 9.5px; margin-right: 2px; }
  .ev.multi.cont { margin-left: -4px; padding-left: 6px; }
  .ev.multi.tobe { margin-right: -4px; padding-right: 6px; }
}

/* 넓은 화면: 날짜 칸을 더 크게 */
@media (min-width: 900px) {
  .day { min-height: 120px; }
  .ev { font-size: 12px; }
}
