.calendar-shell {
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  padding: 0 1px 10px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.weekday {
  text-align: center;
  color: var(--muted-2);
  font-size: 10px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: .08em;
}

.calendar-viewport {
  position: relative;
  overflow: hidden;
  touch-action: pan-y;
  flex: 1 1 auto;
  min-height: 0;
}

.calendar-panel {
  will-change: transform, opacity;
  transition:
    transform 250ms var(--ease),
    opacity 190ms ease;
}

.calendar-panel.dragging {
  transition: none;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: minmax(72px, 1fr);
  gap: 5px;
  padding-top: 10px;
}

.day-spacer {
  min-width: 0;
}

.day {
  appearance: none;
  border: 0;
  border-radius: 16px;
  background: transparent;
  min-width: 0;
  min-height: 72px;
  padding: 9px 4px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  text-align: center;
  color: var(--text);
  cursor: pointer;
  transition:
    background-color 120ms ease,
    transform 100ms ease;
}

.day.has-income {
  background: var(--income-day);
}

.day:active {
  transform: scale(.975);
  background: var(--press);
}

.day-number {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 13px;
  line-height: 1;
  font-weight: 640;
  letter-spacing: -0.02em;
  flex: 0 0 auto;
  text-align: center;
  padding: 0;
  transform: translateY(-2px);
}

.day.today .day-number {
  box-shadow: inset 0 0 0 1.25px var(--line-strong);
}

.day.selected .day-number {
  background: var(--selected);
  color: var(--selected-text);
  box-shadow: none;
}

.day-income {
  width: 100%;
  margin-top: 4px;
  padding-bottom: 7px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.15;
  font-weight: 620;
  letter-spacing: -0.02em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.hint {
  margin-top: auto;
  padding-top: 12px;
  text-align: center;
  color: var(--muted-2);
  font-size: 11px;
  line-height: 1.35;
  flex: 0 0 auto;
}

@media (max-width: 360px) {
  .calendar-grid {
    grid-auto-rows: minmax(66px, 1fr);
    gap: 3px;
  }

  .day {
    min-height: 66px;
    padding-left: 4px;
    padding-right: 4px;
  }

  .day-income {
    font-size: 9px;
  }
}
