:root {
  --bg: #fff8fc;
  --card: rgba(255,255,255,.92);
  --ink: #2b2730;
  --muted: #786f7c;
  --line: #eee3ec;
  --pink: #f3a8c7;
  --pink-deep: #db75a0;
  --sky: #83c9ed;
  --yellow: #ffd96b;
  --shadow: 0 14px 40px rgba(94, 55, 80, .10);
  --radius: 24px;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(243,168,199,.22), transparent 24rem),
    radial-gradient(circle at 90% 12%, rgba(131,201,237,.20), transparent 24rem),
    var(--bg);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.page-shell { width: min(1160px, calc(100% - 28px)); margin: 0 auto; padding: 34px 0 56px; }
.hero { text-align: center; padding: 18px 12px 24px; }
.hero h1, .admin-header h1, .login-card h1 { margin: 10px 0 8px; font-size: clamp(2rem, 5vw, 3.5rem); letter-spacing: -.045em; }
.hero p, .admin-header p, .login-card > p { margin: 0; color: var(--muted); line-height: 1.7; }
.hero-badge { display: inline-flex; align-items: center; gap: 8px; padding: 8px 13px; border-radius: 999px; background: #fff; border: 1px solid var(--line); box-shadow: 0 8px 20px rgba(94,55,80,.05); font-weight: 800; font-size: .78rem; letter-spacing: .08em; }
.card { background: var(--card); border: 1px solid rgba(238,227,236,.95); border-radius: var(--radius); box-shadow: var(--shadow); backdrop-filter: blur(12px); }

.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 18px; padding: 14px 18px; margin-bottom: 18px; font-size: .9rem; color: #5f5763; }
.legend span { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.normal { background: #555; }.dot.tentative { background: #9b95a1; }.dot.conditional { background: #a879d9; }.dot.recruiting { background: #66b98a; }.dot.confirmed { background: #58aee0; }.dot.locked { background: #f39b4c; }.dot.off { background: #eb7fa8; }

.calendar { padding: 18px; overflow: hidden; }
.calendar-toolbar { display: grid; grid-template-columns: 50px 1fr 50px; align-items: center; gap: 12px; padding: 2px 2px 16px; text-align: center; }
.calendar-toolbar h2 { margin: 0 0 3px; font-size: 1.5rem; }
.icon-btn { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 14px; background: #fff; font-size: 2rem; line-height: 1; color: #665d69; }
.text-btn { border: 0; background: transparent; padding: 4px 7px; color: var(--pink-deep); font-weight: 800; }
.weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.weekdays { border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.weekdays span { padding: 10px 4px; text-align: center; font-size: .83rem; font-weight: 800; color: var(--muted); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.weekdays span:first-child { color: #d5668c; }.weekdays span:last-child { color: #4f9dcc; }
.calendar-grid { border-left: 1px solid var(--line); }
.day-cell { min-height: 118px; padding: 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.65); overflow: hidden; }
.day-cell.other-month { background: rgba(249,246,249,.6); color: #bcb5bf; }
.day-cell.today { background: linear-gradient(180deg, rgba(255,240,247,.95), rgba(255,255,255,.8)); box-shadow: inset 0 0 0 2px rgba(243,168,199,.75); }
.day-number { width: 28px; height: 28px; display: inline-flex; justify-content: center; align-items: center; border-radius: 50%; font-size: .88rem; font-weight: 800; }
.today .day-number { background: var(--pink-deep); color: white; }
.event-chips { display: grid; gap: 5px; margin-top: 6px; }
.event-chip { width: 100%; border: 0; text-align: left; border-radius: 9px; padding: 5px 7px; font-size: .72rem; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #39313c; }
.event-chip.normal { background: #efedf0; }.event-chip.tentative { background: #eeebf0; }.event-chip.conditional { background: #eee3f8; color: #74499b; }.event-chip.recruiting { background: #e2f3e8; color: #377b52; }.event-chip.confirmed { background: #dff2fc; color: #367eaa; }.event-chip.locked { background: #fff0df; color: #a65e20; }.event-chip.off { background: #fde4ee; color: #b84f78; }
.more-chip { font-size: .72rem; color: var(--muted); padding: 0 3px; }

.schedule-list-section { margin-top: 18px; padding: 22px; }
.section-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 16px; }
.section-title-row h2 { margin: 3px 0 0; font-size: 1.35rem; }
.eyebrow { margin: 0; color: var(--pink-deep); font-size: .72rem; font-weight: 900; letter-spacing: .1em; }
.updated-text { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.schedule-list, .admin-event-list { display: grid; gap: 10px; }
.schedule-item { display: grid; grid-template-columns: 70px 1fr auto; gap: 14px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.72); }
.schedule-date { text-align: center; }
.schedule-date strong { display: block; font-size: 1.28rem; }.schedule-date span { color: var(--muted); font-size: .78rem; }
.schedule-main strong { display: block; margin-bottom: 4px; }.schedule-main p { margin: 0; color: var(--muted); font-size: .88rem; white-space: pre-wrap; }
.status-pill { display: inline-flex; align-items: center; justify-content: center; padding: 6px 9px; border-radius: 999px; font-size: .73rem; font-weight: 800; white-space: nowrap; }
.status-pill.normal { background: #efedf0; }.status-pill.tentative { background: #eeebf0; }.status-pill.conditional { background: #eee3f8; color: #74499b; }.status-pill.recruiting { background: #e2f3e8; color: #377b52; }.status-pill.confirmed { background: #dff2fc; color: #367eaa; }.status-pill.locked { background: #fff0df; color: #a65e20; }.status-pill.off { background: #fde4ee; color: #b84f78; }
.empty-state { text-align: center; padding: 36px 14px; color: var(--muted); border: 1px dashed var(--line); border-radius: 16px; }
footer { text-align: center; color: var(--muted); font-size: .82rem; padding-top: 18px; }

.detail-dialog { width: min(520px, calc(100% - 28px)); border: 0; border-radius: 22px; padding: 26px; box-shadow: 0 30px 90px rgba(44,29,39,.25); }
.detail-dialog::backdrop { background: rgba(34,28,32,.4); backdrop-filter: blur(3px); }
.dialog-close { position: absolute; top: 10px; right: 12px; border: 0; background: transparent; font-size: 1.8rem; color: var(--muted); }
.dialog-date { margin: 0 0 14px; font-size: 1.25rem; }
.dialog-event { padding: 12px 0; border-top: 1px solid var(--line); }.dialog-event:first-of-type { border-top: 0; }
.dialog-event h3 { margin: 7px 0 6px; }.dialog-event p { margin: 0; color: var(--muted); white-space: pre-wrap; line-height: 1.6; }

.admin-body { background: #fff8fc; }
.admin-shell { width: min(1180px, calc(100% - 28px)); margin: 0 auto; padding: 34px 0 60px; }
.login-card { width: min(480px, 100%); margin: 8vh auto 0; padding: 34px; text-align: center; }
.login-card .stack-form { text-align: left; margin-top: 24px; }
.admin-header { display: flex; justify-content: space-between; gap: 20px; align-items: flex-end; margin-bottom: 20px; padding: 10px 4px; }
.admin-header h1 { font-size: clamp(2rem, 4vw, 3rem); }
.admin-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 18px; align-items: start; }
.editor-card, .admin-list-card { padding: 22px; }
.stack-form { display: grid; gap: 15px; }
.stack-form label { display: grid; gap: 7px; color: #5f5661; font-size: .88rem; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid #ded4dd; border-radius: 12px; background: #fff; padding: 11px 12px; color: var(--ink); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--pink); box-shadow: 0 0 0 3px rgba(243,168,199,.16); }
textarea { resize: vertical; }
.form-row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.primary-btn, .secondary-btn, .ghost-btn, .danger-btn { border-radius: 12px; padding: 11px 16px; font-weight: 850; border: 1px solid transparent; }
.primary-btn { background: linear-gradient(135deg, #ed94b9, #dc78a3); color: white; }
.secondary-btn { background: white; border-color: var(--line); }
.ghost-btn { background: transparent; border-color: var(--line); }
.danger-btn { background: #fff0f2; border-color: #f2ccd4; color: #b84960; }
.form-message { margin: 0; min-height: 1.2em; font-size: .83rem; color: var(--muted); }
.form-message.error { color: #bd3f5d; }.form-message.success { color: #2f8b59; }
.admin-event { border: 1px solid var(--line); border-radius: 16px; padding: 14px; background: #fff; }
.admin-event-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.admin-event h3 { margin: 4px 0 6px; font-size: 1rem; }.admin-event p { margin: 0; color: var(--muted); font-size: .84rem; white-space: pre-wrap; }
.admin-event-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 6px; color: var(--muted); font-size: .78rem; }
.edit-btn { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 7px 10px; font-weight: 800; color: #695d69; }
.private-note { margin-top: 9px !important; padding: 9px 10px; border-radius: 10px; background: #fff8df; color: #7b6a27 !important; }

@media (max-width: 760px) {
  .page-shell, .admin-shell { width: min(100% - 16px, 1160px); padding-top: 20px; }
  .calendar { padding: 8px; border-radius: 18px; }
  .day-cell { min-height: 86px; padding: 5px; }
  .day-number { width: 24px; height: 24px; font-size: .78rem; }
  .event-chip { font-size: .64rem; padding: 4px 5px; }
  .weekdays span { padding: 8px 2px; font-size: .75rem; }
  .schedule-list-section { padding: 16px; }
  .schedule-item { grid-template-columns: 58px 1fr; gap: 10px; }
  .schedule-item .status-pill { grid-column: 2; justify-self: start; }
  .admin-header { align-items: flex-start; flex-direction: column; }
  .admin-grid { grid-template-columns: 1fr; }
  .form-row.two { grid-template-columns: 1fr; }
}

@media (max-width: 460px) {
  .hero { padding-top: 8px; }.hero h1 { font-size: 2.15rem; }
  .legend { justify-content: flex-start; gap: 9px 13px; }
  .day-cell { min-height: 72px; }
  .event-chips { gap: 3px; }.event-chip { padding: 3px 4px; }
  .calendar-toolbar { grid-template-columns: 42px 1fr 42px; }
  .icon-btn { width: 38px; height: 38px; }
}

/* v2: 월간/주간 전환 + 참고/합방멤버 표시 */
.view-switch {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 0 auto 12px;
  padding: 4px;
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.82);
}
.view-btn {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 8px 14px;
  font-size: .82rem;
  font-weight: 850;
}
.view-btn.active {
  color: #8e4668;
  background: #fde8f1;
  box-shadow: 0 3px 12px rgba(216,118,159,.12);
}
.calendar-grid.week-view .day-cell {
  min-height: 165px;
}
.schedule-extra {
  display: grid;
  gap: 4px;
  margin-top: 7px;
}
.info-line {
  margin: 0 !important;
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.55;
  white-space: pre-wrap;
}
.info-line span { font-weight: 800; color: #665b67; }
.info-line.members { color: #665c72; }
.info-line.note { color: #9a5d37; }
.dialog-event .schedule-extra {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff9fc;
  border: 1px solid #f3e5ed;
}
.admin-info-line {
  margin-top: 5px !important;
  line-height: 1.55;
}

@media (max-width: 760px) {
  .calendar-grid.week-view .day-cell { min-height: 112px; }
  .view-switch { margin-bottom: 8px; }
  .view-btn { padding: 7px 11px; font-size: .77rem; }
  .updated-text { white-space: normal; text-align: right; line-height: 1.45; }
}

/* v3: 첫 화면 '이번 주 일정 한눈에 보기' + 공유 카드 */
.hero { padding-top: 8px; padding-bottom: 18px; }
.quick-week {
  padding: 22px;
  margin-bottom: 16px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255,255,255,.96), rgba(255,247,251,.96)),
    var(--card);
}
.quick-week-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}
.quick-week-head h2 { margin: 3px 0 3px; font-size: clamp(1.35rem, 2.5vw, 1.8rem); }
.quick-week-caption { margin: 0; color: var(--muted); font-size: .86rem; }
.quick-week-list { display: grid; gap: 9px; }
.quick-event {
  width: 100%;
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  text-align: left;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255,255,255,.82);
  color: var(--ink);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.quick-event:hover {
  transform: translateY(-1px);
  border-color: #efcddd;
  box-shadow: 0 8px 22px rgba(94,55,80,.07);
}
.quick-event.today-event {
  border-color: #f0b4cc;
  background: linear-gradient(90deg, #fff5fa, #fff);
  box-shadow: inset 4px 0 0 var(--pink-deep);
}
.quick-date { display: grid; gap: 2px; text-align: center; }
.quick-date-main { font-size: 1.18rem; font-weight: 900; letter-spacing: -.03em; }
.quick-date-sub { color: var(--muted); font-size: .73rem; font-weight: 700; }
.quick-event-main { min-width: 0; }
.quick-event-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-weight: 900;
  font-size: 1rem;
  line-height: 1.45;
}
.quick-event-title > span {
  flex: 0 0 auto;
  color: var(--pink-deep);
  font-size: .84rem;
}
.quick-event .schedule-extra { margin-top: 4px; }
.quick-event .info-line { font-size: .79rem; }
.quick-empty { padding: 22px 14px; }

@media (max-width: 760px) {
  .quick-week { padding: 16px; border-radius: 18px; }
  .quick-week-head { flex-direction: column; gap: 6px; }
  .quick-week-head .updated-text { text-align: left; }
  .quick-event { grid-template-columns: 64px minmax(0,1fr); gap: 10px; padding: 12px; }
  .quick-event > .status-pill { grid-column: 2; justify-self: start; }
  .quick-date-main { font-size: 1.05rem; }
}

@media (max-width: 460px) {
  .hero p { font-size: .9rem; }
  .quick-week-caption { font-size: .8rem; }
  .quick-event-title { font-size: .94rem; }
}

/* v4: 주간 보기 안에 상세 일정 직접 표시 + 관리자 새 일정 버튼 */
.schedule-list-section[hidden] { display: none !important; }

.calendar-grid.week-view {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.calendar-grid.week-view .week-day-cell {
  min-height: 360px;
  padding: 10px;
  align-content: start;
  overflow: visible;
}
.week-day-heading {
  display: grid;
  gap: 2px;
  padding-bottom: 9px;
  margin-bottom: 9px;
  border-bottom: 1px solid var(--line);
}
.week-day-date {
  font-size: .95rem;
  font-weight: 900;
  color: var(--ink);
}
.week-day-name {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 750;
}
.week-day-events {
  display: grid;
  gap: 8px;
}
.week-event-card {
  width: 100%;
  display: grid;
  gap: 6px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 10px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 3px 12px rgba(70,42,59,.035);
}
.week-event-card:hover {
  border-color: #efbfd3;
  box-shadow: 0 6px 18px rgba(87,46,70,.07);
}
.week-event-card.normal { border-left: 4px solid #666068; }
.week-event-card.tentative { border-left: 4px solid #aaa4ae; }
.week-event-card.conditional { border-left: 4px solid #aa7ad5; }
.week-event-card.recruiting { border-left: 4px solid #6fbd8b; }
.week-event-card.confirmed { border-left: 4px solid #62afd7; }
.week-event-card.locked { border-left: 4px solid #ef9d55; }
.week-event-card.off { border-left: 4px solid #e77ea6; }
.week-event-top {
  display: flex;
  gap: 5px;
  align-items: center;
  justify-content: space-between;
}
.week-event-time {
  color: var(--pink-deep);
  font-size: .76rem;
  font-weight: 900;
}
.week-event-card .status-pill {
  padding: 4px 6px;
  font-size: .61rem;
}
.week-event-title {
  display: block;
  font-size: .86rem;
  line-height: 1.35;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.week-event-card .schedule-extra {
  gap: 3px;
  margin-top: 1px;
}
.week-event-card .info-line {
  font-size: .7rem;
  line-height: 1.42;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.week-day-empty {
  padding: 18px 4px;
  color: #bbb3bb;
  font-size: .72rem;
  text-align: center;
}
.new-event-btn {
  padding: 8px 12px;
  color: #9a4d70;
  border-color: #efcddd;
  background: #fff8fb;
}

@media (max-width: 900px) {
  .calendar-grid.week-view {
    min-width: 980px;
  }
  .calendar:has(.calendar-grid.week-view) {
    overflow-x: auto;
  }
  .calendar-grid.week-view .week-day-cell { min-height: 330px; }
}

@media (max-width: 760px) {
  .calendar-grid.week-view .week-day-cell { min-height: 300px; padding: 8px; }
  .week-event-card { padding: 8px; }
  .week-event-title { font-size: .8rem; }
  .week-event-card .info-line { font-size: .66rem; }
}
