.mini-calendar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  flex-shrink: 0;
  margin-bottom: 12px;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--transparent);
  text-align: left;
}

.mini-calendar:hover {
  border-color: var(--muted);
  background: var(--surface);
}

.mini-calendar-header {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  font-size: 12px;
  font-weight: 600;
}

.mini-calendar-header svg {
  width: 16px;
  height: 16px;
  color: var(--secondary);
}

#mini-calendar-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
}

#mini-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
  width: 100%;
}

.mini-weekday {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  color: var(--muted);
  font-size: 10px;
}

.mini-day {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 24px;
  border-radius: 4px;
  color: var(--secondary);
  font-size: 12px;
  line-height: 20px;
}

.mini-day.scheduled {
  background: var(--brand-soft);
  color: var(--brand);
}

.mini-day.today {
  background: var(--brand);
  color: var(--black);
  font-weight: 800;
}

.mini-day.scheduled::after {
  position: absolute;
  content: "";
  bottom: 2px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}

#calendar-overlay {
  align-items: center;
  padding: 24px;
}

.calendar-window {
  display: flex;
  flex-direction: column;
  width: 880px;
  max-width: 100%;
  max-height: calc(100dvh - 48px);
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--sidebar);
  box-shadow: 0 16px 64px var(--shadow);
  overflow: hidden;
  animation: window-enter var(--transition-slow) var(--transition-ease) both;
}

#calendar-overlay.closing .calendar-window {
  animation: window-exit var(--transition-normal) ease both;
}

.calendar-header {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 12px;
  min-height: 64px;
  padding: 12px 24px;
  border-bottom: 2px solid var(--border);
}

.calendar-header > .icon {
  color: var(--brand);
}

.calendar-header > .icon svg {
  width: 24px;
  height: 24px;
}

.calendar-header h2 {
  flex: 1;
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.calendar-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 0;
  padding: 24px;
  overflow: auto;
  scrollbar-width: thin;
}

.calendar-navigation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.calendar-selectors {
  display: flex;
  align-items: center;
  gap: 8px;
}

.calendar-selectors select {
  appearance: auto;
  min-height: 36px;
  padding: 6px 12px;
  border: 2px solid var(--border);
  border-radius: 6px;
  outline: none;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.calendar-selectors select:focus {
  border-color: var(--brand);
}

.calendar-navigation button:disabled {
  opacity: 0.4;
  cursor: default;
}

.calendar-today {
  min-height: 36px;
  padding: 6px 12px;
  border: 2px solid var(--border);
  border-radius: 6px;
  color: var(--secondary);
  font-size: 12px;
}

.calendar-today:hover {
  color: var(--brand);
}

#calendar-months {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  user-select: none;
}

.calendar-month-panel {
  min-width: 0;
}

.calendar-month-title {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px 0;
}

.calendar-weekday {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  color: var(--muted);
  font-size: 12px;
}

.calendar-weekday.weekend {
  color: var(--secondary);
}

.calendar-day,
.calendar-blank {
  height: 40px;
}

.calendar-day {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 0;
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  touch-action: none;
  transition: background var(--transition-fast) ease, color var(--transition-fast) ease;
}

.calendar-day:hover {
  background: var(--hover);
}

.calendar-day.today {
  color: var(--brand);
  font-weight: 800;
  box-shadow: inset 0 0 0 2px var(--border);
}

.calendar-day.in-range {
  border-radius: 0;
  background: var(--brand-soft);
  color: var(--brand);
}

.calendar-day.range-start {
  border-radius: 6px 0 0 6px;
  background: var(--brand);
  color: var(--black);
  font-weight: 800;
  box-shadow: none;
}

.calendar-day.range-end {
  border-radius: 0 6px 6px 0;
  background: var(--brand);
  color: var(--black);
  font-weight: 800;
  box-shadow: none;
}

.calendar-day.range-start.range-end {
  border-radius: 6px;
}

.calendar-day.scheduled::after {
  position: absolute;
  content: "";
  bottom: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--brand);
}

.calendar-day.range-start.scheduled::after,
.calendar-day.range-end.scheduled::after {
  background: var(--black);
}

#calendar-months.selecting .calendar-day {
  cursor: crosshair;
  transition-duration: 0ms;
}

#schedule-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 20px;
  border-top: 2px solid var(--border);
}

.schedule-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.schedule-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  color: var(--secondary);
  font-size: 12px;
}

.schedule-field input,
#schedule-name {
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: 6px;
  outline: none;
  background: var(--background);
  color: var(--text);
  font-size: 14px;
  transition: border-color var(--transition-fast) ease;
}

.schedule-field input:focus,
#schedule-name:focus {
  border-color: var(--brand);
}

.schedule-submit-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

#schedule-name {
  flex: 1;
}

#schedule-name::placeholder {
  color: var(--muted);
}

.schedule-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 6px;
  background: var(--brand);
  color: var(--black);
  font-weight: 600;
}

.schedule-submit:hover {
  background: var(--brand);
  opacity: 0.8;
}

.schedule-submit svg {
  width: 16px;
  height: 16px;
}

.schedule-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 16px;
  border-top: 2px solid var(--border);
}

.schedule-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.schedule-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

#schedule-count {
  color: var(--muted);
  font-size: 12px;
}

#schedule-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.schedule-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 56px;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--surface);
  transition: background var(--transition-fast) ease;
}

.schedule-item:hover {
  background: var(--hover);
}

.schedule-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 6px;
  background: var(--brand-soft);
  color: var(--brand);
}

.schedule-item-icon svg {
  width: 18px;
  height: 18px;
}

.schedule-item-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 2px;
  min-width: 0;
}

.schedule-item-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.schedule-item-description {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.schedule-remove:hover {
  color: var(--danger);
}

.schedule-empty {
  padding: 24px 12px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

#calendar-months .birthday-day,
#mini-calendar-grid .birthday-day {
  position: relative;
  overflow: visible;
}

#calendar-months .birthday-day::before,
#mini-calendar-grid .birthday-day::before {
  content: attr(data-birthday);
  position: absolute;
  top: -4px;
  left: 50%;
  z-index: 2;
  font-size: 20px;
  line-height: 100%;
  transform: translateX(4px) rotate(16deg);
  pointer-events: none;
  user-select: none;
}

#mini-calendar-grid .birthday-day::before {
  top: -4px;
  font-size: 12px;
  transform: translateX(2px) rotate(16deg);
}