.calendar-native-control {
  position: absolute;
  width: 0;
  height: 0;
  padding: 0;
  margin: 0;
  border: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.calendar-picker-trigger {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--background);
  color: var(--text);
  text-align: left;
  transition: background 120ms ease, border-color 160ms ease, color 120ms ease;
}

.calendar-picker-trigger:hover {
  background: var(--surface);
  border-color: var(--muted);
}

.calendar-picker-trigger[aria-expanded="true"] {
  border-color: var(--brand);
  background: var(--surface);
}

.calendar-picker-trigger svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: var(--secondary);
}

.calendar-picker-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.calendar-month-trigger {
  min-height: 36px;
  min-width: 144px;
  padding: 6px 12px;
  background: var(--surface);
}

.calendar-month-trigger svg {
  transition: transform 160ms var(--transition-ease);
}

.calendar-month-trigger[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.calendar-picker-popup {
  position: fixed;
  z-index: 88;
  display: flex;
  flex-direction: column;
  width: 344px;
  max-width: calc(100vw - 16px);
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--sidebar);
  box-shadow: 0 12px 40px var(--shadow);
  animation: picker-enter 200ms var(--transition-ease) both;
}

.calendar-picker-popup.closing {
  pointer-events: none;
  animation: picker-exit 160ms ease both;
}

.calendar-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
  padding: 0 4px 8px 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.calendar-picker-header .icon-button {
  width: 28px;
  height: 28px;
}

.calendar-picker-header .icon-button svg {
  width: 16px;
  height: 16px;
}

.calendar-picker-body {
  position: relative;
  height: 180px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--background);
}

.calendar-picker-highlight {
  position: absolute;
  top: 72px;
  right: 6px;
  left: 6px;
  height: 36px;
  border-radius: 6px;
  background: var(--selected);
  pointer-events: none;
}

.calendar-picker-wheels {
  position: relative;
  display: flex;
  align-items: stretch;
  width: 100%;
  height: 100%;
  padding: 0 8px;
}

.picker-wheel {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 180px;
  padding: 72px 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  touch-action: pan-y;
  outline: none;
}

.picker-wheel::-webkit-scrollbar {
  display: none;
}

.picker-wheel-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 36px;
  min-height: 36px;
  padding: 0 4px;
  border-radius: 4px;
  background: var(--transparent);
  color: var(--secondary);
  font-size: 16px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  scroll-snap-align: center;
  transition: color 120ms ease, opacity 120ms ease, transform 120ms ease;
  cursor: pointer;
}

.picker-wheel-item:hover {
  background: var(--transparent);
  color: var(--white);
}

.picker-wheel-item.active {
  color: var(--brand);
  font-size: 18px;
  font-weight: 600;
  opacity: 1;
  transform: scale(1);
}

.picker-wheel-item[data-distance="1"] {
  opacity: 0.6;
  transform: scale(0.96);
}

.picker-wheel-item[data-distance="2"] {
  opacity: 0.2;
  transform: scale(0.88);
}

.picker-wheel-item[data-distance="3"],
.picker-wheel-item[data-distance="4"] {
  opacity: 0;
}

.calendar-picker-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 12px;
}

.picker-cancel,
.picker-apply {
  min-width: 76px;
  min-height: 36px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
}

.picker-cancel {
  border: 2px solid var(--border);
  color: var(--secondary);
  background: var(--transparent);
}

.picker-cancel:hover {
  color: var(--white);
  background: var(--surface);
}

.picker-apply {
  border: 2px solid var(--brand);
  background: var(--brand);
  color: var(--black);
}

.picker-apply:hover {
  background: var(--brand);
  opacity: 0.8;
}

.mini-day.scheduled::after {
  display: none;
}

.calendar-window {
  height: min(840px, calc(100dvh - 48px));
  min-height: 0;
  max-height: calc(100dvh - 48px);
}

.calendar-header {
  flex-shrink: 0;
}

.calendar-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.calendar-navigation,
#calendar-months,
#schedule-form,
.schedule-section {
  flex-shrink: 0;
}

.calendar-grid {
  grid-template-rows: 28px repeat(6, var(--calendar-day-height, 40px));
  grid-auto-rows: var(--calendar-day-height, 40px);
}

.calendar-day,
.calendar-blank {
  height: var(--calendar-day-height, 40px);
}

.schedule-section {
  min-height: 0;
  flex: 1;
}

.schedule-header {
  flex-shrink: 0;
  min-height: 24px;
}

#schedule-list {
  flex: 1;
  height: 128px;
  min-height: 128px;
  max-height: 128px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-gutter: stable;
}

.schedule-item {
  flex-shrink: 0;
}

.schedule-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 100%;
  padding: 12px;
}

.calendar-selectors .calendar-native-control,
.schedule-field .calendar-native-control {
  display: none !important;
}

@keyframes picker-enter {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes picker-exit {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  to {
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
  }
}