@font-face {
  font-family: "Pretendard Variable";
  src: url("./assets/PretendardVariable.woff2") format("woff2-variations");
  font-weight: 45 920;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #eef6fb;
  --panel: #fff;
  --ink: #101d2c;
  --muted: #66788a;
  --line: #d5e3ed;
  --brand: #11867d;
  --brand-dark: #0b6d66;
  --brand-soft: #e7f7f4;
  --danger: #c62828;
  --shadow: 0 18px 48px rgba(23, 33, 43, .1);
  font-family: "Pretendard Variable", "Pretendard", "Noto Sans KR", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--bg); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.schedule-shell { width: min(100% - 32px, 1840px); margin: 0 auto; padding: 18px 0 32px; }
.topbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  align-items: center;
  gap: 14px 18px;
  margin-bottom: 14px;
}
.topbar h1, .topbar p { margin: 0; }
.header-actions, .topbar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}
.topbar-actions {
  justify-content: flex-end;
}
.account-menu {
  position: relative;
  flex: 0 0 auto;
}
.account-menu summary {
  display: flex;
  align-items: center;
  gap: 7px;
  list-style: none;
  white-space: nowrap;
  cursor: pointer;
}
.account-menu summary::-webkit-details-marker { display: none; }
.account-avatar {
  display: grid;
  place-items: center;
}
.account-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 50;
  display: grid;
  width: min(300px, calc(100vw - 24px));
  background: #fff;
}
.account-popover strong {
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-popover > span {
  color: var(--muted);
  font-size: 12px;
}
.account-popover a,
.account-popover button {
  display: grid;
  margin-top: 5px;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}
.server-monitor {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
}
.server-monitor span {
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  color: #465769;
  background: #fff;
  font-weight: 850;
}
.server-monitor .status-dot::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--brand);
}

.schedule-notice {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
  padding: 13px 17px;
  border: 1px solid #b9e3dc;
  border-radius: 14px;
  color: #28665f;
  background: #edfaf7;
}
.schedule-notice strong { flex: 0 0 auto; color: var(--brand-dark); }

.calendar-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.calendar-toolbar {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.month-controls, .calendar-filters { display: flex; gap: 8px; align-items: center; }
.month-controls h2 { min-width: 150px; margin: 0 4px; font-size: 24px; text-align: center; }
.month-controls button, .calendar-filters button {
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #34485b;
  background: #fff;
  font-weight: 800;
}
.month-controls button:first-child, .month-controls button:nth-child(3) { width: 40px; padding: 0; font-size: 25px; }
.calendar-filters label { display: grid; gap: 4px; color: var(--muted); font-size: 11px; font-weight: 800; }
.calendar-filters select, .calendar-filters input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 11px;
  color: var(--ink);
  background: #fff;
}
.calendar-filters input { width: 220px; }
.calendar-filters button { align-self: end; color: #fff; border-color: var(--brand); background: var(--brand); }

.calendar-scroll { min-width: 980px; }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-weekdays { border-bottom: 1px solid var(--line); background: #f7fafb; }
.calendar-weekdays span { padding: 9px; color: #506274; font-size: 12px; font-weight: 850; text-align: center; }
.calendar-weekdays span:first-child { color: #dc4545; }
.calendar-weekdays span:last-child { color: #2877c7; }

.calendar-day {
  min-height: 142px;
  padding: 8px 7px 9px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.calendar-day:nth-child(7n) { border-right: 0; background: #f8fbff; }
.calendar-day:nth-child(7n + 1) { background: #fffafa; }
.calendar-day.outside { background: #f8fafb; }
.calendar-day.today { box-shadow: inset 0 0 0 2px rgba(17, 134, 125, .55); }
.day-number { display: inline-grid; width: 25px; height: 25px; margin-bottom: 5px; place-items: center; border-radius: 50%; color: #34485b; font-size: 12px; font-weight: 850; }
.calendar-day:nth-child(7n + 1) .day-number { color: #dc4545; }
.calendar-day:nth-child(7n) .day-number { color: #2877c7; }
.calendar-day.outside .day-number { opacity: .38; }
.calendar-day.today .day-number { color: #fff; background: var(--brand); }
.day-events { display: grid; gap: 4px; }
.calendar-event {
  display: flex;
  min-width: 0;
  gap: 5px;
  align-items: center;
  width: 100%;
  padding: 3px 4px;
  border: 0;
  border-radius: 5px;
  color: #2f4051;
  background: transparent;
  font-size: 11px;
  font-weight: 720;
  text-align: left;
}
.calendar-event::before { content: ""; flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; background: var(--event-color, var(--brand)); }
.calendar-event .time { flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.calendar-event .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-event.block {
  padding: 4px 6px;
  color: #fff;
  background: var(--event-color, var(--brand));
}
.calendar-event.block::before { display: none; }
.calendar-event.color-0 { --event-color: #11867d; }
.calendar-event.color-1 { --event-color: #4f63c7; }
.calendar-event.color-2 { --event-color: #d06d16; }
.calendar-event.color-3 { --event-color: #8b5bb5; }
.calendar-event.color-4 { --event-color: #2c7cad; }
.calendar-event.color-5 { --event-color: #b34b68; }
.calendar-event.color-6 { --event-color: #527f38; }
.more-events {
  width: 100%;
  padding: 3px 5px;
  border: 0;
  border-radius: 6px;
  color: #6546c5;
  background: #f4f1ff;
  font-size: 11px;
  font-weight: 850;
  text-align: left;
  cursor: pointer;
}
.more-events:hover,
.more-events:focus-visible { outline: 2px solid rgb(101 70 197 / 28%); background: #ebe5ff; }
.calendar-empty { grid-column: 1 / -1; min-height: 500px; display: grid; place-items: center; color: var(--muted); }

dialog { width: min(92vw, 620px); padding: 0; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 25px 80px rgba(18, 35, 51, .28); }
dialog::backdrop {
  background: rgba(25, 40, 54, .48);
  backdrop-filter: blur(3px);
  animation: dialog-backdrop-in 150ms ease-out;
}
@keyframes dialog-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.event-detail { padding: 24px; }
.event-detail header { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.event-detail header p { margin: 0 0 4px; color: var(--brand); font-size: 12px; font-weight: 850; }
.event-detail h2 { margin: 0; font-size: 23px; }
.event-detail header button { width: 38px; height: 38px; border: 0; border-radius: 50%; color: #617284; background: #f2f5f7; font-size: 24px; }
.event-detail dl { display: grid; gap: 0; margin: 22px 0 0; }
.event-detail dl div { display: grid; grid-template-columns: 82px 1fr; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.event-detail dt { color: var(--muted); font-size: 13px; font-weight: 800; }
.event-detail dd { margin: 0; line-height: 1.55; white-space: pre-wrap; }
.event-detail footer { display: flex; justify-content: flex-end; padding-top: 18px; }
.event-detail footer button { min-height: 40px; padding: 0 18px; border: 0; border-radius: 10px; color: #fff; background: var(--brand); font-weight: 850; }
.day-events-dialog { width: min(92vw, 680px); }
.day-events-detail { padding: 0; }
.day-events-detail header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, #f0faf8 0%, #f5f1ff 100%);
}
.day-events-detail header div { display: grid; gap: 4px; }
.day-events-detail header p { margin: 0; color: var(--brand); font-size: 12px; font-weight: 850; }
.day-events-detail h2 { margin: 0; font-size: 23px; }
.day-events-detail header span { color: var(--muted); font-size: 12px; font-weight: 750; }
.day-events-detail header button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  color: #617284;
  background: rgb(255 255 255 / 75%);
  font-size: 24px;
  cursor: pointer;
}
.day-events-list {
  display: grid;
  max-height: min(620px, 68vh);
  gap: 7px;
  overflow-y: auto;
  padding: 12px;
}
.day-event-item {
  display: grid;
  grid-template-columns: 5px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 13px 14px 13px 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
  text-align: left;
  cursor: pointer;
}
.day-event-item:hover,
.day-event-item:focus-visible { outline: none; border-color: #dcd5f8; background: #f8f6ff; }
.day-event-color { align-self: stretch; border-radius: 999px; background: var(--event-color, var(--brand)); }
.day-event-item.color-0 { --event-color: #11867d; }
.day-event-item.color-1 { --event-color: #4f63c7; }
.day-event-item.color-2 { --event-color: #d06d16; }
.day-event-item.color-3 { --event-color: #8b5bb5; }
.day-event-item.color-4 { --event-color: #2c7cad; }
.day-event-item.color-5 { --event-color: #b34b68; }
.day-event-item.color-6 { --event-color: #527f38; }
.day-event-copy { display: grid; min-width: 0; gap: 3px; }
.day-event-copy small { color: var(--muted); font-size: 12px; }
.day-event-copy strong { overflow: hidden; font-size: 15px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.day-event-copy > span { overflow: hidden; color: #5b6b7c; font-size: 12px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.day-event-item > b { color: #6546c5; font-size: 17px; }
.toast-stack { position: fixed; right: 22px; bottom: 22px; z-index: 80; display: grid; gap: 8px; }
.toast { max-width: 390px; padding: 12px 15px; border-radius: 11px; color: #fff; background: #2c4659; box-shadow: var(--shadow); }
.toast.error { background: #b42318; }

@media (prefers-reduced-motion: reduce) {
  dialog::backdrop { animation: none; }
}

@media (max-width: 900px) {
  .schedule-shell { width: calc(100% - 18px); padding-top: 9px; }
  .topbar { grid-template-columns: 1fr; }
  .header-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
  }
  .schedule-shell .topbar-actions {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: visible;
    padding-bottom: 3px;
    scrollbar-width: none;
  }
  .schedule-shell .topbar-actions::-webkit-scrollbar { display: none; }
  .topbar-actions > a, .nav-menu { flex: 0 0 auto; }
  .schedule-notice, .calendar-toolbar { align-items: stretch; flex-direction: column; }
  .calendar-filters { flex-wrap: wrap; }
  .calendar-filters label:last-of-type { flex: 1 1 220px; }
  .calendar-filters input { width: 100%; }
  .calendar-panel { overflow-x: auto; }
}

@media (max-width: 560px) {
  .topbar { padding: 14px; }
  .header-actions { grid-template-columns: 1fr; }
  .schedule-shell .topbar-actions { flex-wrap: wrap; overflow: visible; padding-bottom: 0; }
  .account-menu { justify-self: stretch; }
  .account-menu summary { justify-content: center; }
  .account-popover { right: 0; left: auto; }
  .schedule-notice { font-size: 13px; }
  .month-controls { justify-content: space-between; }
  .month-controls h2 { min-width: 120px; font-size: 20px; }
  .calendar-filters { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
  .calendar-filters label:first-of-type { grid-column: 1 / -1; justify-self: start; min-width: 0; max-width: 100%; }
  .calendar-filters label:first-of-type select { max-width: 100%; }
  .calendar-filters label:last-of-type { min-width: 0; }
}
